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

Function TEST

src/plugin/test/num_range_checker.cpp:9–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7using namespace mgb;
8
9TEST(TestNumRangeChecker, Simple) {
10 HostTensorGenerator<> gen;
11 auto graph = ComputingGraph::make();
12 NumRangeChecker checker{graph.get(), 1e30f};
13 auto av = gen({3}), bv = gen({3});
14 auto a = opr::Host2DeviceCopy::make(*graph, av),
15 b = opr::Host2DeviceCopy::make(*graph, bv), c = a / b;
16 auto func = graph->compile({{c, {}}});
17 auto pb = bv->ptr<float>();
18 pb[0] = 2;
19 pb[1] = -1;
20 pb[2] = 3;
21 func->execute();
22 pb[1] = 0;
23 ASSERT_THROW(func->execute(), NumRangeChecker::Error);
24}
25
26TEST(TestNumRangeChecker, MultiDType) {
27 HostTensorGenerator<dtype::Int32> gen;

Callers

nothing calls this directly

Calls 12

make_callback_copyFunction · 0.85
get_counter_varMethod · 0.80
makeFunction · 0.50
genFunction · 0.50
getMethod · 0.45
compileMethod · 0.45
executeMethod · 0.45
add_inputMethod · 0.45
add_outputMethod · 0.45
push_backMethod · 0.45
owner_graphMethod · 0.45
nodeMethod · 0.45

Tested by

no test coverage detected