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

Function TEST

src/opr/test/io.cpp:37–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35} // namespace
36
37TEST(TestOprIO, H2D) {
38 HostTensorGenerator<> gen;
39 auto t0 = gen({123, 456});
40 HostTensorND t1(CompNode::load("xpu0"));
41
42 auto graph = ComputingGraph::make();
43 SymbolVar y = opr::Host2DeviceCopy::make(*graph, t0);
44
45 bool executed = false;
46 auto func = graph->compile({{y, [&](DeviceTensorND& v) {
47 executed = true;
48 t1.copy_from(v);
49 }}});
50 func->execute();
51 ASSERT_TRUE(executed);
52 MGB_ASSERT_TENSOR_EQ(*t0, t1.sync());
53}
54
55TEST(TestOprIO, H2DCopyShallow) {
56 HostTensorGenerator<> gen;

Callers

nothing calls this directly

Calls 15

make_no_value_inferFunction · 0.85
make_callback_copyFunction · 0.85
TensorLayoutClass · 0.85
output_fileFunction · 0.85
unpack_vectorFunction · 0.85
testFunction · 0.85
backMethod · 0.80
resizeMethod · 0.80
copy_from_fixlayoutMethod · 0.80
renameMethod · 0.80
prev_dev_ptrMethod · 0.80
graph_compileMethod · 0.80

Tested by

no test coverage detected