MCPcopy Create free account
hub / github.com/apache/tvm-ffi / TEST

Function TEST

tests/cpp/test_shape.cc:27–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25using namespace tvm::ffi;
26
27TEST(Shape, Basic) {
28 Shape shape = Shape({1, 2, 3});
29 EXPECT_EQ(shape.size(), 3);
30 EXPECT_EQ(shape[0], 1);
31 EXPECT_EQ(shape[1], 2);
32 EXPECT_EQ(shape[2], 3);
33
34 Shape shape2 = Shape(Array<int64_t>({4, 5, 6, 7}));
35 EXPECT_EQ(shape2.size(), 4);
36 EXPECT_EQ(shape2[0], 4);
37 EXPECT_EQ(shape2[1], 5);
38 EXPECT_EQ(shape2[2], 6);
39 EXPECT_EQ(shape2[3], 7);
40
41 std::vector<int64_t> vec = {8, 9, 10};
42 Shape shape3 = Shape(std::move(vec));
43 EXPECT_EQ(shape3.size(), 3);
44 EXPECT_EQ(shape3[0], 8);
45 EXPECT_EQ(shape3[1], 9);
46 EXPECT_EQ(shape3[2], 10);
47 EXPECT_EQ(shape3.Product(), 8 * 9 * 10);
48
49 Shape shape4 = Shape();
50 EXPECT_EQ(shape4.size(), 0);
51 EXPECT_EQ(shape4.Product(), 1);
52}
53
54TEST(Shape, AnyConvert) {
55 Shape shape0 = Shape({1, 2, 3});

Callers

nothing calls this directly

Calls 4

ShapeClass · 0.50
sizeMethod · 0.45
ProductMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected