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

Function test_smelu

dlib/test/dnn.cpp:949–973  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

947 }
948
949 void test_smelu()
950 {
951 IF_DLIB_USE_CUDA(
952 using namespace dlib::tt;
953 print_spinner();
954 const long n = 4;
955 const long k = 5;
956 const long nr = 3;
957 const long nc = 3;
958 const float beta = 1;
959 resizable_tensor src(n, k, nr, nc);
960 tt::tensor_rand rnd;
961 rnd.fill_gaussian(src);
962 resizable_tensor dest_cuda, dest_cpu;
963 dest_cuda.copy_size(src);
964 dest_cpu.copy_size(src);
965 // initialize to different values in order to make sure the output is actually changed
966 dest_cuda = 1;
967 dest_cpu = 2;
968 cuda::smelu(dest_cuda, src, beta);
969 cpu::smelu(dest_cpu, src, beta);
970
971 DLIB_TEST_MSG(max(abs(mat(dest_cuda) - mat(dest_cpu))) < 1e-7, max(abs(mat(dest_cuda) - mat(dest_cpu))));
972 )
973 }
974
975 void test_silu()
976 {

Callers 1

run_testsMethod · 0.85

Calls 6

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

Tested by

no test coverage detected