// File: /workspace/github_c_makefile_star2_O1/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 0x688b(%rip), %rdi      # 0x80e8
leaq 0x9c94(%rip), %rsi      # 0xb4f8
leaq 0x30(%rsp), %rdx
callq 0x1a10
testl %eax, %eax
je 0x1891
leaq 0x67cc(%rip), %rdi      # 0x8045
leaq 0x67db(%rip), %rsi      # 0x805b
leaq 0x6883(%rip), %rdx      # 0x810a
movl $0x10c, %ecx            # imm = 0x10C
jmp 0x1946
leaq 0x6877(%rip), %rdi      # 0x810f
leaq 0x9c61(%rip), %rsi      # 0xb500
leaq 0x20(%rsp), %rdx
callq 0x1a10
testl %eax, %eax
je 0x18c9
leaq 0x6791(%rip), %rdi      # 0x8045
leaq 0x67a0(%rip), %rsi      # 0x805b
leaq 0x6848(%rip), %rdx      # 0x810a
movl $0x110, %ecx            # imm = 0x110
jmp 0x1946
leaq 0x6860(%rip), %rdi      # 0x8130
leaq 0x9c31(%rip), %rsi      # 0xb508
leaq 0x10(%rsp), %rdx
callq 0x1a10
testl %eax, %eax
je 0x1901
leaq 0x6759(%rip), %rdi      # 0x8045
leaq 0x6768(%rip), %rsi      # 0x805b
leaq 0x6810(%rip), %rdx      # 0x810a
movl $0x114, %ecx            # imm = 0x114
jmp 0x1946
leaq 0x6848(%rip), %rdi      # 0x8150
leaq 0x10(%rsp), %rsi
callq 0x19c8
leaq 0x67f6(%rip), %rdi      # 0x810f
leaq 0x9bf0(%rip), %rsi      # 0xb510
movq %rsp, %rdx
callq 0x1a10
testl %eax, %eax
je 0x1958
leaq 0x6712(%rip), %rdi      # 0x8045
leaq 0x6721(%rip), %rsi      # 0x805b
leaq 0x67c9(%rip), %rdx      # 0x810a
movl $0x119, %ecx            # imm = 0x119
xorl %eax, %eax
callq 0x1030
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x40, %rsp
popq %rbx
retq
leaq 0x67f7(%rip), %rdi      # 0x8156
movq %rsp, %rsi
callq 0x19c8
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x9b58(%rip)      # 0xb4d0
leaq 0x9949(%rip), %rdi      # 0xb2c8
movaps 0x66aa(%rip), %xmm0     # 0x8030
movups %xmm0, 0x9b4b(%rip)     # 0xb4d8
leaq 0xeb4(%rip), %rax       # 0x2848
movq %rax, 0x9b4d(%rip)      # 0xb4e8
callq 0x2e8b
movq %rax, 0x9919(%rip)      # 0xb2c0
leaq 0x30(%rsp), %rbx
movl (%rbx), %esi
movl 0x4(%rbx), %edx
callq 0x127c
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x16fa
xorl %eax, %eax
jmp 0x1952
nop