// File: /workspace/github_c_makefile_star2_O2/xtanitfy[P]Murphy/examples/mnist/mnist_train.c
// Function: main
int main(void)
{
	int ret = -1;

	/*��ȡ��������*/
	SIZE_s trainXSize;
	ret = Mnist_GetData(TRAIN_X_FILE,&gTrainX,&trainXSize);
	CHECK_EXPR_RET(ret,-1);
	
	SIZE_s trainYSize;
	ret = Mnist_GetData(TRAIN_Y_FILE,&gTrainY,&trainYSize);
	CHECK_EXPR_RET(ret,-1);

	SIZE_s testXSize;
	ret = Mnist_GetData(TEST_X_FILE,&gTestX,&testXSize);
	CHECK_EXPR_RET(ret,-1);
	Mnist_PrintSize("testX",&testXSize);
	
	SIZE_s testYSize;
	ret = Mnist_GetData(TRAIN_Y_FILE,&gTestY,&testYSize);
	CHECK_EXPR_RET(ret,-1);
	Mnist_PrintSize("testY",&testYSize);
	
	//Mnist_dataNormalie(gTrainX,&trainXSize);

#if 0
	/*��ʼ��������*/
	OPTS_s opts;
	opts.alpha = 1;
	opts.batchsize = 50;
	opts.numepochs = 1;
	opts.channels = 1;//sizeof(double);
	opts.loss_function = functionLoss1;
	opts.classifyNum = 10;
	ret = NET_init(&opts);
	CHECK_EXPR_RET(ret != 0,ret);
#else
	
	netTrainPara.alpha = 1;
	netTrainPara.batchsize = 50;
	netTrainPara.numepochs = 1;
	netTrainPara.channels = 1;//sizeof(double);
	netTrainPara.loss_function = functionLoss1;
	netTrainPara.classifyNum = 10;
	pNetTrain = NET_create(&netTrainPara);
#endif


	MnistBuildTrainNet(netTrainPara.batchsize,trainXSize.h,trainXSize.w);

	MnistTrainRun(&trainXSize,&trainYSize);


	/*������Ҫ���¹����������磬��Ϊbatches�����˱仯*/
#if 0
	OPTS_s *pOPts = NET_GetOpts();
	pOPts->batchsize = testXSize.n;
	CHECK_EXPR_RET(inputPara.hSize != testXSize.h,-1);
	CHECK_EXPR_RET(inputPara.wSize != testXSize.w,-1);
	
	int testXAllSize = pOPts->batchsize * testXSize.h * testXSize.w;
	NET_setInputData(gTestX,testXAllSize);

	int testYAllSize = pOPts->batchsize * testYSize.h * testYSize.w;
	NET_setTableYData(gTestY,testYAllSize);

	ret = NET_test();
	CHECK_EXPR_RET(ret != 0,-1);
#endif
	return 0;
}

// Assembly:
pushq %rbx
subq $0x40, %rsp
leaq 0x58d3(%rip), %rdi      # 0x70e8
leaq 0x9cec(%rip), %rsi      # 0xb508
leaq 0x30(%rsp), %rdx
callq 0x19c8
testl %eax, %eax
je 0x1849
leaq 0x5814(%rip), %rdi      # 0x7045
leaq 0x5823(%rip), %rsi      # 0x705b
leaq 0x58cb(%rip), %rdx      # 0x710a
movl $0x10c, %ecx            # imm = 0x10C
jmp 0x18fe
leaq 0x58bf(%rip), %rdi      # 0x710f
leaq 0x9cb9(%rip), %rsi      # 0xb510
leaq 0x20(%rsp), %rdx
callq 0x19c8
testl %eax, %eax
je 0x1881
leaq 0x57d9(%rip), %rdi      # 0x7045
leaq 0x57e8(%rip), %rsi      # 0x705b
leaq 0x5890(%rip), %rdx      # 0x710a
movl $0x110, %ecx            # imm = 0x110
jmp 0x18fe
leaq 0x58a8(%rip), %rdi      # 0x7130
leaq 0x9c89(%rip), %rsi      # 0xb518
leaq 0x10(%rsp), %rdx
callq 0x19c8
testl %eax, %eax
je 0x18b9
leaq 0x57a1(%rip), %rdi      # 0x7045
leaq 0x57b0(%rip), %rsi      # 0x705b
leaq 0x5858(%rip), %rdx      # 0x710a
movl $0x114, %ecx            # imm = 0x114
jmp 0x18fe
leaq 0x5890(%rip), %rdi      # 0x7150
leaq 0x10(%rsp), %rsi
callq 0x1980
leaq 0x583e(%rip), %rdi      # 0x710f
leaq 0x9c48(%rip), %rsi      # 0xb520
movq %rsp, %rdx
callq 0x19c8
testl %eax, %eax
je 0x190e
leaq 0x575a(%rip), %rdi      # 0x7045
leaq 0x5769(%rip), %rsi      # 0x705b
leaq 0x5811(%rip), %rdx      # 0x710a
movl $0x119, %ecx            # imm = 0x119
xorl %eax, %eax
callq 0x1030
pushq $-0x1
popq %rax
addq $0x40, %rsp
popq %rbx
retq
leaq 0x5841(%rip), %rdi      # 0x7156
movq %rsp, %rsi
callq 0x1980
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x9bb2(%rip)      # 0xb4e0
leaq 0x99a3(%rip), %rdi      # 0xb2d8
leaq 0xd31(%rip), %rax       # 0x266d
movq %rax, 0x9bb5(%rip)      # 0xb4f8
movaps 0x56e6(%rip), %xmm0     # 0x7030
movups %xmm0, 0x9b97(%rip)     # 0xb4e8
callq 0x2c0e
movq %rax, 0x9973(%rip)      # 0xb2d0
leaq 0x30(%rsp), %rbx
movl (%rbx), %esi
movl 0x4(%rbx), %edx
callq 0x128c
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x16b1
xorl %eax, %eax
jmp 0x1908
nopl (%rax)