MCPcopy Create free account
hub / github.com/davisking/dlib / test_reorg

Function test_reorg

dlib/test/dnn.cpp:5706–5722  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5704// ----------------------------------------------------------------------------------------
5705
5706 void test_reorg()
5707 {
5708 IF_DLIB_USE_CUDA(
5709 print_spinner();
5710 resizable_tensor x(2, 4, 8, 16);
5711 resizable_tensor out_cpu(2, 16, 4, 8), out_cuda(2, 16, 4, 8);
5712 resizable_tensor grad_cpu(x), grad_cuda(x);
5713 tt::tensor_rand rnd;
5714 rnd.fill_gaussian(x);
5715 cpu::reorg(false, out_cpu, 2, 2, x);
5716 cuda::reorg(false, out_cuda, 2, 2, x);
5717 DLIB_TEST(max(squared(mat(out_cuda) - mat(out_cpu))) == 0);
5718 cpu::reorg_gradient(false, grad_cpu, 2, 2, out_cpu);
5719 cuda::reorg_gradient(false, grad_cuda, 2, 2, out_cuda);
5720 DLIB_TEST(max(squared(mat(out_cuda) - mat(out_cpu))) == 0);
5721 )
5722 }
5723
5724 void test_input_tensor()
5725 {

Callers 1

run_testsMethod · 0.85

Calls 6

print_spinnerFunction · 0.85
squaredFunction · 0.85
reorgFunction · 0.50
maxFunction · 0.50
matFunction · 0.50
reorg_gradientFunction · 0.50

Tested by

no test coverage detected