// File: /workspace/github_c_makefile_star2_O3/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 0x58ca(%rip), %rdi      # 0x70e8
leaq 0x8ce3(%rip), %rsi      # 0xa508
leaq 0x30(%rsp), %rdx
callq 0x19d0
testl %eax, %eax
je 0x1852
leaq 0x580b(%rip), %rdi      # 0x7045
leaq 0x581a(%rip), %rsi      # 0x705b
leaq 0x58c2(%rip), %rdx      # 0x710a
movl $0x10c, %ecx            # imm = 0x10C
jmp 0x1907
leaq 0x58b6(%rip), %rdi      # 0x710f
leaq 0x8cb0(%rip), %rsi      # 0xa510
leaq 0x20(%rsp), %rdx
callq 0x19d0
testl %eax, %eax
je 0x188a
leaq 0x57d0(%rip), %rdi      # 0x7045
leaq 0x57df(%rip), %rsi      # 0x705b
leaq 0x5887(%rip), %rdx      # 0x710a
movl $0x110, %ecx            # imm = 0x110
jmp 0x1907
leaq 0x589f(%rip), %rdi      # 0x7130
leaq 0x8c80(%rip), %rsi      # 0xa518
leaq 0x10(%rsp), %rdx
callq 0x19d0
testl %eax, %eax
je 0x18c2
leaq 0x5798(%rip), %rdi      # 0x7045
leaq 0x57a7(%rip), %rsi      # 0x705b
leaq 0x584f(%rip), %rdx      # 0x710a
movl $0x114, %ecx            # imm = 0x114
jmp 0x1907
leaq 0x5887(%rip), %rdi      # 0x7150
leaq 0x10(%rsp), %rsi
callq 0x1988
leaq 0x5835(%rip), %rdi      # 0x710f
leaq 0x8c3f(%rip), %rsi      # 0xa520
movq %rsp, %rdx
callq 0x19d0
testl %eax, %eax
je 0x1919
leaq 0x5751(%rip), %rdi      # 0x7045
leaq 0x5760(%rip), %rsi      # 0x705b
leaq 0x5808(%rip), %rdx      # 0x710a
movl $0x119, %ecx            # imm = 0x119
xorl %eax, %eax
callq 0x1030
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x40, %rsp
popq %rbx
retq
leaq 0x5836(%rip), %rdi      # 0x7156
movq %rsp, %rsi
callq 0x1988
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x8ba7(%rip)      # 0xa4e0
leaq 0x8998(%rip), %rdi      # 0xa2d8
leaq 0xe95(%rip), %rax       # 0x27dc
movq %rax, 0x8baa(%rip)      # 0xa4f8
movaps 0x56db(%rip), %xmm0     # 0x7030
movups %xmm0, 0x8b8c(%rip)     # 0xa4e8
callq 0x2dcd
movq %rax, 0x8968(%rip)      # 0xa2d0
leaq 0x30(%rsp), %rbx
movl (%rbx), %esi
movl 0x4(%rbx), %edx
callq 0x128c
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x16ba
xorl %eax, %eax
jmp 0x1913