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

Function TEST

src/gopt/test/basic_arith.cpp:54–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52} // anonymous namespace
53
54TEST(TestGoptBasicArithInplace, EqToUnit) {
55 HostTensorGenerator<> gen;
56 auto graph = ComputingGraph::make();
57 auto x = opr::Host2DeviceCopy::make(*graph, gen({2, 3}));
58 auto a = x - x, b = x / x;
59 ASSERT_EQ(a.as_immutable_scalar()->get_cast<float>(), 0.f);
60 ASSERT_EQ(b.as_immutable_scalar()->get_cast<float>(), 1.f);
61 TensorShape shp{2, 3};
62 ASSERT_EQ(a.shape(), shp);
63 ASSERT_EQ(b.shape(), shp);
64}
65
66TEST(TestGoptBasicArithInplace, ZeroOne) {
67 HostTensorGenerator<> gen;

Callers

nothing calls this directly

Calls 15

TensorShapeClass · 0.85
make_callback_copyFunction · 0.85
powfFunction · 0.85
unpack_vectorFunction · 0.85
expand_elem_chainFunction · 0.85
var_from_tensor_shapeFunction · 0.85
gradFunction · 0.85
output_fileFunction · 0.85
powcFunction · 0.85
make_no_value_inferFunction · 0.85
is_static_var_valueFunction · 0.85
as_immutable_scalarMethod · 0.80

Tested by

no test coverage detected