// File: /workspace/github_cpp_makefile_star2_O1/btbujiangjun[P]abcdl/src/rnn/RNN.cpp
// Function: abcdl::rnn::RNN::load_model(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool RNN::load_model(const std::string& path){
    std::vector<abcdl::algebra::Mat*> models;
    if(!loader.read<real>(path, &models,"RNNMODEL") || models.size() != 3){
        for(auto&& model : models){
            delete model;
        }
        return false;
    }
    
    _U = *(models[0]);
    _W = *(models[1]);
    _U = *(models[2]);

    _feature_dim    = _U.cols();
    _hidden_dim     = _U.rows();
    _path           = path;

    if(_layer != nullptr){
        delete _layer;
    }
    _layer = new abcdl::rnn::Layer(_hidden_dim, _bptt_truncate, new abcdl::framework::CrossEntropyCost(), new abcdl::framework::TanhActivateFunc());

    for(auto&& mat : models){
        delete mat;
    }
    models.clear();

    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r14
movq %rdi, %rbx
pxor %xmm0, %xmm0
movdqa %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x25922(%rip), %rsi     # 0x49ca1
leaq 0x25923(%rip), %rdx     # 0x49ca9
leaq 0x20(%rsp), %rdi
callq 0x14914
leaq 0x50(%rbx), %rdi
movq %rsp, %rdx
leaq 0x20(%rsp), %rcx
movq %r14, %rsi
callq 0x246c8
testb %al, %al
je 0x24537
movq 0x8(%rsp), %r12
subq (%rsp), %r12
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x243c4
callq 0xa440
cmpq $0x18, %r12
jne 0x24546
movq (%rsp), %rax
movq (%rax), %rsi
leaq 0x70(%rbx), %r15
movq %r15, %rdi
callq 0x24aa8
movq (%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0xa8(%rbx), %rdi
callq 0x24aa8
movq (%rsp), %rax
movq 0x10(%rax), %rsi
movq %r15, %rdi
callq 0x24aa8
movdqu 0x70(%rbx), %xmm0
pshufd $0x4e, %xmm0, %xmm0     # xmm0 = xmm0[2,3,0,1]
movdqu %xmm0, (%rbx)
leaq 0x30(%rbx), %rdi
movq %r14, %rsi
callq 0xa230
movq 0x118(%rbx), %r14
testq %r14, %r14
je 0x24451
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x2443a
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x24449
movq (%rdi), %rax
callq *0x8(%rax)
movq %r14, %rdi
callq 0xa440
movl $0x30, %edi
callq 0xa460
movq %rax, %r14
movdqu 0x8(%rbx), %xmm0
movdqa %xmm0, 0x40(%rsp)
movl $0x18, %edi
callq 0xa460
movq %rax, %r15
pxor %xmm0, %xmm0
movdqa %xmm0, (%rax)
movq $0x0, 0x10(%rax)
leaq 0x44a43(%rip), %rax     # 0x68ed0
movq %rax, (%r15)
movq %r15, %rdi
addq $0x8, %rdi
callq 0xd874
leaq 0x449dd(%rip), %rax     # 0x68e80
movq %rax, (%r15)
movl $0x18, %edi
callq 0xa460
movq %rax, %r12
pxor %xmm0, %xmm0
movdqa %xmm0, (%rax)
movq $0x0, 0x10(%rax)
leaq 0x44a86(%rip), %rax     # 0x68f50
movq %rax, (%r12)
movq %r12, %rdi
addq $0x8, %rdi
callq 0xd874
leaq 0x44a17(%rip), %rax     # 0x68ef8
movq %rax, (%r12)
movq %r14, %rdi
addq $0x20, %rdi
callq 0xd874
movdqa 0x40(%rsp), %xmm0
movdqu %xmm0, (%r14)
movq %r15, 0x10(%r14)
movq %r12, 0x18(%r14)
movq %r14, 0x118(%rbx)
movq (%rsp), %r14
movq 0x8(%rsp), %r15
cmpq %r15, %r14
je 0x24590
movq (%r14), %rbx
testq %rbx, %rbx
je 0x24531
movq %rbx, %rdi
callq 0x26dc2
movq %rbx, %rdi
callq 0xa440
addq $0x8, %r14
jmp 0x24514
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x24546
callq 0xa440
movq (%rsp), %r14
movq 0x8(%rsp), %r15
cmpq %r15, %r14
je 0x24572
movq (%r14), %rbx
testq %rbx, %rbx
je 0x2456c
movq %rbx, %rdi
callq 0x26dc2
movq %rbx, %rdi
callq 0xa440
addq $0x8, %r14
jmp 0x2454f
xorl %ebx, %ebx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x24582
callq 0xa440
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq (%rsp), %rax
movb $0x1, %bl
cmpq %rax, 0x8(%rsp)
je 0x24574
movq %rax, 0x8(%rsp)
jmp 0x24574
movq %rax, %rbx
movq %r12, %rdi
jmp 0x245b2
movq %rax, %rbx
movq %r15, %rdi
callq 0xa440
jmp 0x245bc
movq %rax, %rbx
movq %r14, %rdi
jmp 0x245ce
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x245da
callq 0xa440
jmp 0x245da
jmp 0x245d7
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x245e8
callq 0xa440
movq %rbx, %rdi
callq 0xa780