// File: /workspace/github_cpp_makefile_star2_O2/btbujiangjun[P]abcdl/example/rnn.cpp
// Function: main
int main(int argc, char** argv){
    abcdl::utils::log::set_min_log_level(abcdl::utils::log::INFO);
    abcdl::utils::log::initialize_log(argc, argv);

/*
    abcdl::rnn::RNN rnn(28, 100);
    rnn.set_epoch(50);
   
    const int train_size = 100;
    const int test_size = 10;
    abcdl::utils::FashionMnistReader<real> helper("data");
    std::vector<abcdl::algebra::Mat*> train_data;
    std::vector<abcdl::algebra::Mat*> train_label;
    helper.read_train_images(&train_data, train_size);
    helper.read_train_vec_labels(&train_label, train_size);

    LOG(INFO) << "RNN Start training....";
    LOG(INFO) << "training size:" << train_data.size();
    rnn.train(train_data, train_label);
	
    for(auto&& d : train_data){
		delete d;
	}
	train_data.clear();
	
	for(auto&& d : train_label){
		delete d;
	}
	train_label.clear();
*/
	abcdl::utils::RNNHelper helper(8000);
	
	//std::map<std::string, size_t> map;
	//helper.read_word2index("data/rnn/word_to_index", map);

    const size_t sample_size = 1000;
	abcdl::algebra::MatSet data_seq_data;
	abcdl::algebra::MatSet data_seq_label;
	if(!helper.read_seq_data("data/rnn/train_seq_data", data_seq_data, "data/rnn/train_seq_label", data_seq_label, sample_size)){
		return -1;
	}

    LOG(INFO) << "RNN Start training....";

    abcdl::rnn::RNN rnn(8000, 100);
    rnn.set_epoch(50);
    rnn.load_model("./data/rnn_seq.model");

    LOG(INFO) << "training size:" << data_seq_data.size();
    rnn.train(data_seq_data, data_seq_label);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x2f8, %rsp            # imm = 0x2F8
movq %rsi, %rbx
movl %edi, %ebp
xorl %edi, %edi
callq 0x3a5ae
movl %ebp, %edi
movq %rbx, %rsi
callq 0x3a2b8
movq $0x1f40, 0x48(%rsp)     # imm = 0x1F40
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movaps %xmm0, 0x30(%rsp)
andq $0x0, 0x40(%rsp)
leaq 0x30cc2(%rip), %rsi     # 0x3c211
leaq 0x50(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0xa180
leaq 0x30cc4(%rip), %rsi     # 0x3c229
leaq 0x1d8(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0xa180
leaq 0x48(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x1d8(%rsp), %rcx
leaq 0x30(%rsp), %r8
movl $0x3e8, %r9d            # imm = 0x3E8
callq 0xb238
movl %eax, %ebx
leaq 0x1d8(%rsp), %rdi
callq 0xa1d0
leaq 0x50(%rsp), %rdi
callq 0xa1d0
testb %bl, %bl
je 0xb6bb
leaq 0x30c7c(%rip), %rsi     # 0x3c242
leaq 0x50(%rsp), %rdi
pushq $0x38
popq %rdx
xorl %ecx, %ecx
callq 0x3a600
leaq 0x30c76(%rip), %rsi     # 0x3c252
leaq 0x50(%rsp), %rdi
callq 0xa480
leaq 0x50(%rsp), %rdi
callq 0x3a83c
leaq 0x1d8(%rsp), %rdi
pushq $0x64
popq %rdx
movl $0x1f40, %esi           # imm = 0x1F40
callq 0x117b8
movq $0x32, 0x1f0(%rsp)
leaq 0x30c51(%rip), %rsi     # 0x3c269
leaq 0x50(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0xa180
leaq 0x1d8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x2143a
leaq 0x50(%rsp), %rdi
callq 0xa1d0
leaq 0x30bf8(%rip), %rsi     # 0x3c242
leaq 0x50(%rsp), %rdi
pushq $0x3e
popq %rdx
xorl %ecx, %ecx
callq 0x3a600
leaq 0x30c1e(%rip), %rsi     # 0x3c27e
leaq 0x50(%rsp), %rdi
callq 0xa480
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
pushq $0x28
popq %rcx
cqto
idivq %rcx
leaq 0x50(%rsp), %rdi
movq %rax, %rsi
callq 0xa2e0
leaq 0x50(%rsp), %rdi
callq 0x3a83c
leaq 0x1d8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x20b10
leaq 0x1d8(%rsp), %rdi
callq 0x11ab6
xorl %ebx, %ebx
jmp 0xb6be
pushq $-0x1
popq %rbx
leaq 0x30(%rsp), %rdi
callq 0x11bee
leaq 0x10(%rsp), %rdi
callq 0x11bee
movl %ebx, %eax
addq $0x2f8, %rsp            # imm = 0x2F8
popq %rbx
popq %rbp
retq
jmp 0xb702
jmp 0xb6e2
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x3a83c
jmp 0xb705
jmp 0xb702
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0xa1d0
jmp 0xb705
movq %rax, %rbx
leaq 0x1d8(%rsp), %rdi
callq 0x11ab6
jmp 0xb74b
jmp 0xb748
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x3a83c
jmp 0xb74b
jmp 0xb748
movq %rax, %rbx
leaq 0x1d8(%rsp), %rdi
callq 0xa1d0
jmp 0xb73c
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0xa1d0
jmp 0xb74b
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x11bee
leaq 0x10(%rsp), %rdi
callq 0x11bee
movq %rbx, %rdi
callq 0xa7a0
nop