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

Function test_silu

dlib/test/dnn.cpp:975–998  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

973 }
974
975 void test_silu()
976 {
977 IF_DLIB_USE_CUDA(
978 using namespace dlib::tt;
979 print_spinner();
980 const long n = 4;
981 const long k = 5;
982 const long nr = 3;
983 const long nc = 3;
984 resizable_tensor src(n, k, nr, nc);
985 tt::tensor_rand rnd;
986 rnd.fill_gaussian(src);
987 resizable_tensor dest_cuda, dest_cpu;
988 dest_cuda.copy_size(src);
989 dest_cpu.copy_size(src);
990 // initialize to different values in order to make sure the output is actually changed
991 dest_cuda = 1;
992 dest_cpu = 2;
993 cuda::silu(dest_cuda, src);
994 cpu::silu(dest_cpu, src);
995
996 DLIB_TEST_MSG(max(abs(mat(dest_cuda) - mat(dest_cpu))) < 1e-6, max(abs(mat(dest_cuda) - mat(dest_cpu))));
997 )
998 }
999
1000 void test_batch_normalize()
1001 {

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