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

Function test_mish

dlib/test/dnn.cpp:794–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

792 }
793
794 void test_mish()
795 {
796 IF_DLIB_USE_CUDA(
797 // make sure that cuda::mish and cpu::mish return the same results
798 using namespace dlib::tt;
799 print_spinner();
800 const long n = 4;
801 const long k = 5;
802 const long nr = 3;
803 const long nc = 3;
804 resizable_tensor src(n,k,nr,nc);
805 tt::tensor_rand rnd;
806 rnd.fill_gaussian(src);
807
808 resizable_tensor dest1, dest2;
809 dest1.copy_size(src);
810 dest2.copy_size(src);
811 // initialize to different values in order to make sure the output is actually changed
812 dest1 = 1;
813 dest2 = 2;
814 cuda::mish(dest1, src);
815 cpu::mish(dest2, src);
816 DLIB_TEST_MSG(max(abs(mat(dest1) - mat(dest2))) < 1e-6, max(abs(mat(dest1) - mat(dest2))));
817 )
818 }
819
820 void test_leaky_relu()
821 {

Callers 1

run_testsMethod · 0.85

Calls 6

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

Tested by

no test coverage detected