// File: /workspace/github_cpp_makefile_star2_O2/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 $0x68, %rsp
movq %rsi, %r14
movq %rdi, %rbx
pxor %xmm0, %xmm0
movdqa %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
leaq 0x1d83f(%rip), %rsi     # 0x3eca1
leaq 0x30(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0xa180
leaq 0x50(%rbx), %rdi
leaq 0x10(%rsp), %rdx
leaq 0x30(%rsp), %rcx
movq %r14, %rsi
callq 0x21882
testb %al, %al
je 0x215f8
movq 0x18(%rsp), %r15
subq 0x10(%rsp), %r15
leaq 0x30(%rsp), %rdi
callq 0xa1d0
cmpq $0x18, %r15
jne 0x21602
movq 0x10(%rsp), %rax
movq (%rax), %rsi
leaq 0x70(%rbx), %r15
movq %r15, %rdi
callq 0x21bb2
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0xa8(%rbx), %rdi
callq 0x21bb2
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rsi
movq %r15, %rdi
callq 0x21bb2
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 0xa260
movq 0x118(%rbx), %r14
testq %r14, %r14
je 0x2151d
movq %r14, %rdi
callq 0x11bc8
movq %r14, %rdi
callq 0xa470
pushq $0x30
popq %rdi
callq 0xa490
movq %rax, %r14
movdqu 0x8(%rbx), %xmm0
movdqa %xmm0, 0x50(%rsp)
pushq $0x18
popq %rdi
callq 0xa490
movq %rax, %r15
pxor %xmm0, %xmm0
movdqa %xmm0, (%rax)
andq $0x0, 0x10(%rax)
leaq 0x3e9ae(%rip), %rax     # 0x5ff00
movq %rax, (%r15)
movq %r15, %rdi
addq $0x8, %rdi
callq 0xcf2a
leaq 0x3e948(%rip), %rax     # 0x5feb0
movq %rax, (%r15)
pushq $0x18
popq %rdi
callq 0xa490
movq %rax, %r12
pxor %xmm0, %xmm0
movdqa %xmm0, (%rax)
andq $0x0, 0x10(%rax)
leaq 0x3e9f6(%rip), %rax     # 0x5ff80
movq %rax, (%r12)
movq %r12, %rdi
addq $0x8, %rdi
callq 0xcf2a
leaq 0x3e987(%rip), %rax     # 0x5ff28
movq %rax, (%r12)
movq %r14, %rdi
addq $0x20, %rdi
callq 0xcf2a
movdqa 0x50(%rsp), %xmm0
movdqu %xmm0, (%r14)
movq %r15, 0x10(%r14)
movq %r12, 0x18(%r14)
movq %r14, 0x118(%rbx)
movq 0x10(%rsp), %r14
movq 0x18(%rsp), %r15
cmpq %r15, %r14
je 0x21649
movq (%r14), %rbx
testq %rbx, %rbx
je 0x215ea
movq %rbx, %rdi
callq 0x23a32
movq %rbx, %rdi
callq 0xa470
addq $0x8, %r14
jmp 0x215d5
leaq 0x30(%rsp), %rdi
callq 0xa1d0
movq 0x10(%rsp), %r14
movq 0x18(%rsp), %r15
cmpq %r15, %r14
je 0x2162f
movq (%r14), %rbx
testq %rbx, %rbx
je 0x21621
movq %rbx, %rdi
callq 0x23a32
movq %rbx, %rdi
callq 0xa470
addq $0x8, %r14
jmp 0x2160c
xorl %ebx, %ebx
leaq 0x10(%rsp), %rdi
callq 0x21f76
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x10(%rsp), %rax
movb $0x1, %bl
cmpq %rax, 0x18(%rsp)
je 0x21631
movq %rax, 0x18(%rsp)
jmp 0x21631
movq %rax, %rbx
movq %r12, %rdi
jmp 0x2166c
movq %rax, %rbx
movq %r15, %rdi
callq 0xa470
jmp 0x21676
movq %rax, %rbx
movq %r14, %rdi
callq 0xa470
jmp 0x21694
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xa1d0
jmp 0x21694
jmp 0x21691
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x21f76
movq %rbx, %rdi
callq 0xa7a0