| 7 | using namespace opr; |
| 8 | |
| 9 | TEST(TestTensorGen, Alloc) { |
| 10 | auto host_x = |
| 11 | std::make_shared<HostTensorND>(CompNode::load("xpu0"), dtype::Int32()); |
| 12 | auto graph = ComputingGraph::make(); |
| 13 | auto x = opr::Host2DeviceCopy::make_no_value_infer(*graph, host_x), |
| 14 | y = opr::Alloc::make(x, dtype::Float32()); |
| 15 | HostTensorND host_y; |
| 16 | auto func = graph->compile({make_callback_copy(y, host_y)}); |
| 17 | auto px = host_x->resize({3}).ptr<int>(); |
| 18 | px[0] = 2; |
| 19 | px[1] = 3; |
| 20 | px[2] = 5; |
| 21 | func->execute(); |
| 22 | |
| 23 | ASSERT_EQ(TensorShape({2, 3, 5}), host_y.shape()); |
| 24 | } |
| 25 | |
| 26 | TEST(TestTensorGen, Linspace) { |
| 27 | auto host_num = |
nothing calls this directly
no test coverage detected