MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / assert_uniform_correct

Function assert_uniform_correct

dnn/test/naive/rng.cpp:11–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10template <typename ctype>
11void assert_uniform_correct(const ctype* src, size_t size) {
12 for (size_t i = 0; i < size; ++i) {
13 ASSERT_GT(src[i], ctype(0));
14 ASSERT_LE(src[i], ctype(1));
15 }
16 auto stat = get_mean_var(src, size, ctype(0.5));
17 ASSERT_LE(std::abs(stat.first - 0.5), 1e-3);
18 ASSERT_LE(std::abs(stat.second - 1.0 / 12), 1e-3);
19}
20
21namespace {
22template <typename dtype>

Callers 4

TEST_FFunction · 0.85
TEST_FFunction · 0.85
run_uniformFunction · 0.85
TEST_FFunction · 0.85

Calls 2

get_mean_varFunction · 0.85
absFunction · 0.50

Tested by

no test coverage detected