// File: xbai0624[P]dnn/src/UnitTest.cpp
// Function: UnitTest::TestImagesStruct()
void UnitTest::TestImagesStruct()
{
    // test Images struct in Layer.h file

    // 1) empty test
    Images __images;
    //Images v_image0 = __images.Vectorization();

    // 2) vectorization functionality test
    cout<<"vectorization test"<<endl;
    for(int i=0;i<4;i++)
    {
        Matrix kernel(3,4);
        kernel.Random(); // fill matrix with random numbers
        __images.OutputImageFromKernel.push_back(kernel);
    }
    for(auto &i: __images.OutputImageFromKernel)
        cout<<i<<endl<<endl;

    // 2-1) test copy
    cout<<"test copy."<<endl;
    Images c_image = __images;
    for(auto &i: c_image.OutputImageFromKernel)
        cout<<i<<endl<<endl;
    Images v_image = __images.Vectorization();
    for(auto &i: v_image.OutputImageFromKernel)
        cout<<i<<endl<<endl;

    // 3) dimension not match test
    //Matrix k(2, 4, 0);
    //__images.OutputImageFromKernel.push_back(k);
    //v_image = __images.Vectorization();

    // 4) tensorization test
    cout<<"Tensorization test"<<endl;
    Images tensor_image = v_image.Tensorization(3, 4);
    for(auto &i: tensor_image.OutputImageFromKernel)
        cout<<i<<endl<<endl;
}

// Assembly:
subq $0x168, %rsp            # imm = 0x168
movq %rdi, 0x160(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x1fda0
movq 0x203a5(%rip), %rdi     # 0x6afd8
leaq 0xb7aa(%rip), %rsi      # 0x563e4
callq 0x4230
movq %rax, 0x50(%rsp)
jmp 0x4ac46
movq 0x50(%rsp), %rdi
movq 0x2035e(%rip), %rsi     # 0x6afb0
callq 0x4260
jmp 0x4ac59
movl $0x0, 0x138(%rsp)
cmpl $0x4, 0x138(%rsp)
jge 0x4ad10
leaq 0x120(%rsp), %rdi
movl $0x3, %esi
movl $0x4, %edx
callq 0x3b3b0
jmp 0x4ac8b
leaq 0x120(%rsp), %rdi
callq 0x3d7c0
jmp 0x4ac9a
leaq 0x148(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x1fa50
jmp 0x4acb1
leaq 0x120(%rsp), %rdi
callq 0x3bb80
movl 0x138(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x138(%rsp)
jmp 0x4ac64
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x4b148
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x3bb80
jmp 0x4b148
leaq 0x148(%rsp), %rax
movq %rax, 0x118(%rsp)
movq 0x118(%rsp), %rdi
callq 0x1fe00
movq %rax, 0x110(%rsp)
movq 0x118(%rsp), %rdi
callq 0x1fe30
movq %rax, 0x108(%rsp)
leaq 0x110(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x1fe60
testb $0x1, %al
jne 0x4ad65
jmp 0x4add4
leaq 0x110(%rsp), %rdi
callq 0x1fea0
movq %rax, 0x100(%rsp)
movq 0x100(%rsp), %rsi
movq 0x2024f(%rip), %rdi     # 0x6afd8
callq 0x3d640
movq %rax, 0x48(%rsp)
jmp 0x4ad95
movq 0x48(%rsp), %rdi
movq 0x2020f(%rip), %rsi     # 0x6afb0
callq 0x4260
movq %rax, 0x40(%rsp)
jmp 0x4adad
movq 0x40(%rsp), %rdi
movq 0x201f7(%rip), %rsi     # 0x6afb0
callq 0x4260
jmp 0x4adc0
jmp 0x4adc2
leaq 0x110(%rsp), %rdi
callq 0x1ff20
jmp 0x4ad4a
movq 0x201fd(%rip), %rdi     # 0x6afd8
leaq 0xb615(%rip), %rsi      # 0x563f7
callq 0x4230
movq %rax, 0x38(%rsp)
jmp 0x4adee
movq 0x38(%rsp), %rdi
movq 0x201b6(%rip), %rsi     # 0x6afb0
callq 0x4260
jmp 0x4ae01
leaq 0xe8(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0x32860
jmp 0x4ae18
leaq 0xe8(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0xe0(%rsp), %rdi
callq 0x1fe00
movq %rax, 0xd8(%rsp)
movq 0xe0(%rsp), %rdi
callq 0x1fe30
movq %rax, 0xd0(%rsp)
leaq 0xd8(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x1fe60
testb $0x1, %al
jne 0x4ae70
jmp 0x4aef8
leaq 0xd8(%rsp), %rdi
callq 0x1fea0
movq %rax, 0xc8(%rsp)
movq 0xc8(%rsp), %rsi
movq 0x20144(%rip), %rdi     # 0x6afd8
callq 0x3d640
movq %rax, 0x30(%rsp)
jmp 0x4aea0
movq 0x30(%rsp), %rdi
movq 0x20104(%rip), %rsi     # 0x6afb0
callq 0x4260
movq %rax, 0x28(%rsp)
jmp 0x4aeb8
movq 0x28(%rsp), %rdi
movq 0x200ec(%rip), %rsi     # 0x6afb0
callq 0x4260
jmp 0x4aecb
jmp 0x4aecd
leaq 0xd8(%rsp), %rdi
callq 0x1ff20
jmp 0x4ae52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x4b13b
leaq 0xb0(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0x217c0
jmp 0x4af0f
leaq 0xb0(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rdi
callq 0x1fe00
movq %rax, 0xa0(%rsp)
movq 0xa8(%rsp), %rdi
callq 0x1fe30
movq %rax, 0x98(%rsp)
leaq 0xa0(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x1fe60
testb $0x1, %al
jne 0x4af67
jmp 0x4afef
leaq 0xa0(%rsp), %rdi
callq 0x1fea0
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rsi
movq 0x2004d(%rip), %rdi     # 0x6afd8
callq 0x3d640
movq %rax, 0x20(%rsp)
jmp 0x4af97
movq 0x20(%rsp), %rdi
movq 0x2000d(%rip), %rsi     # 0x6afb0
callq 0x4260
movq %rax, 0x18(%rsp)
jmp 0x4afaf
movq 0x18(%rsp), %rdi
movq 0x1fff5(%rip), %rsi     # 0x6afb0
callq 0x4260
jmp 0x4afc2
jmp 0x4afc4
leaq 0xa0(%rsp), %rdi
callq 0x1ff20
jmp 0x4af49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x4b12e
movq 0x1ffe2(%rip), %rdi     # 0x6afd8
leaq 0xb405(%rip), %rsi      # 0x56402
callq 0x4230
movq %rax, 0x10(%rsp)
jmp 0x4b009
movq 0x10(%rsp), %rdi
movq 0x1ff9b(%rip), %rsi     # 0x6afb0
callq 0x4260
jmp 0x4b01c
leaq 0x78(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
movl $0x3, %edx
movl $0x4, %ecx
callq 0x514a0
jmp 0x4b03a
leaq 0x78(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rdi
callq 0x1fe00
movq %rax, 0x68(%rsp)
movq 0x70(%rsp), %rdi
callq 0x1fe30
movq %rax, 0x60(%rsp)
leaq 0x68(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x1fe60
testb $0x1, %al
jne 0x4b077
jmp 0x4b0f5
leaq 0x68(%rsp), %rdi
callq 0x1fea0
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rsi
movq 0x1ff46(%rip), %rdi     # 0x6afd8
callq 0x3d640
movq %rax, 0x8(%rsp)
jmp 0x4b09e
movq 0x8(%rsp), %rdi
movq 0x1ff06(%rip), %rsi     # 0x6afb0
callq 0x4260
movq %rax, (%rsp)
jmp 0x4b0b5
movq (%rsp), %rdi
movq 0x1fef0(%rip), %rsi     # 0x6afb0
callq 0x4260
jmp 0x4b0c7
jmp 0x4b0c9
leaq 0x68(%rsp), %rdi
callq 0x1ff20
jmp 0x4b062
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x1fde0
jmp 0x4b12e
leaq 0x78(%rsp), %rdi
callq 0x1fde0
leaq 0xb0(%rsp), %rdi
callq 0x1fde0
leaq 0xe8(%rsp), %rdi
callq 0x1fde0
leaq 0x148(%rsp), %rdi
callq 0x1fde0
addq $0x168, %rsp            # imm = 0x168
retq
leaq 0xb0(%rsp), %rdi
callq 0x1fde0
leaq 0xe8(%rsp), %rdi
callq 0x1fde0
leaq 0x148(%rsp), %rdi
callq 0x1fde0
movq 0x140(%rsp), %rdi
callq 0x43f0
nopw %cs:(%rax,%rax)