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

Function compare_gradients

dlib/test/dnn.cpp:524–536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

522
523 template <typename T>
524 float compare_gradients (
525 const tensor& t,
526 T grad
527 )
528 {
529 float max_error = 0;
530 auto p = t.host();
531 for (size_t i = 0; i < t.size(); ++i)
532 {
533 max_error = std::max(max_error, std::abs(p[i]-grad(i)));
534 }
535 return max_error;
536 }
537
538// ----------------------------------------------------------------------------------------
539

Callers 6

test_tanhFunction · 0.85
test_sigmoidFunction · 0.85
test_softmaxFunction · 0.85
test_softmax_allFunction · 0.85
test_batch_normalizeFunction · 0.85

Calls 4

absFunction · 0.85
maxFunction · 0.50
hostMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected