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

Function test_silu

dlib/test/dnn.cpp:480–503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

478 }
479
480 void test_silu()
481 {
482#ifdef DLIB_USE_CUDA
483 using namespace dlib::tt;
484 print_spinner();
485 const long n = 4;
486 const long k = 5;
487 const long nr = 3;
488 const long nc = 3;
489 resizable_tensor src(n, k, nr, nc);
490 tt::tensor_rand rnd;
491 rnd.fill_gaussian(src);
492 resizable_tensor dest_cuda, dest_cpu;
493 dest_cuda.copy_size(src);
494 dest_cpu.copy_size(src);
495 // initialize to different values in order to make sure the output is actually changed
496 dest_cuda = 1;
497 dest_cpu = 2;
498 cuda::silu(dest_cuda, src);
499 cpu::silu(dest_cpu, src);
500
501 DLIB_TEST_MSG(max(abs(mat(dest_cuda) - mat(dest_cpu))) < 1e-6, max(abs(mat(dest_cuda) - mat(dest_cpu))));
502#endif // DLIB_USE_CUDA
503 }
504
505 void test_batch_normalize()
506 {

Callers 1

run_testsMethod · 0.85

Calls 6

print_spinnerFunction · 0.85
absFunction · 0.85
copy_sizeMethod · 0.80
siluFunction · 0.50
maxFunction · 0.50
matFunction · 0.50

Tested by

no test coverage detected