| 35 | } // namespace |
| 36 | |
| 37 | TEST(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 | |
| 55 | TEST(TestOprIO, H2DCopyShallow) { |
| 56 | HostTensorGenerator<> gen; |
nothing calls this directly
no test coverage detected