| 9 | using namespace opr; |
| 10 | |
| 11 | TEST(TestOprUtility, InputCallback) { |
| 12 | HostTensorGenerator<> gen; |
| 13 | DeviceTensorND dv; |
| 14 | auto hv = gen({2, 3}); |
| 15 | dv.copy_from(*hv).sync(); |
| 16 | auto graph = ComputingGraph::make(); |
| 17 | auto callback = [dv]() { return dv; }; |
| 18 | auto outputs = opr::InputCallback::make( |
| 19 | *graph, callback, dv.comp_node(), dv.dtype(), {2, 3}); |
| 20 | |
| 21 | HostTensorND hout; |
| 22 | ComputingGraph::OutputSpec outspec{make_callback_copy(outputs[0], hout)}; |
| 23 | auto func = graph->compile(outspec); |
| 24 | func->execute(); |
| 25 | MGB_ASSERT_TENSOR_EQ(hout, *hv); |
| 26 | } |
| 27 | |
| 28 | TEST(TestOprUtility, OutputCallback) { |
| 29 | HostTensorGenerator<> gen; |
nothing calls this directly
no test coverage detected