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

Function TEST

src/opr/test/tensor_gen.cpp:9–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7using namespace opr;
8
9TEST(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
26TEST(TestTensorGen, Linspace) {
27 auto host_num =

Callers

nothing calls this directly

Calls 13

make_no_value_inferFunction · 0.85
make_callback_copyFunction · 0.85
TensorShapeClass · 0.85
resizeMethod · 0.80
renameMethod · 0.80
makeFunction · 0.70
loadFunction · 0.50
compileMethod · 0.45
executeMethod · 0.45
shapeMethod · 0.45
owner_graphMethod · 0.45
nodeMethod · 0.45

Tested by

no test coverage detected