MCPcopy Create free account
hub / github.com/cactus-compute/cactus / test_cat

Function test_cat

tests/test_graph.cpp:60–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60bool test_cat() {
61 TestUtils::FP16TestFixture fixture("Cat (multiple input tensors)");
62
63 size_t input_a = fixture.create_input({2, 3});
64 size_t input_b = fixture.create_input({2, 5});
65 size_t input_c = fixture.create_input({2, 2});
66
67 size_t cat_result = fixture.graph().cat({input_a, input_b, input_c}, 1);
68
69 std::vector<__fp16> data_a = {1, 2, 3,
70 4, 5, 6};
71
72 std::vector<__fp16> data_b = {1, 2, 3, 4, 5,
73 6, 7, 8, 9, 10};
74
75 std::vector<__fp16> data_c = {-1, -2,
76 -1, -2};
77
78 std::vector<__fp16> expected = {
79 1, 2, 3, 1, 2, 3, 4, 5, -1, -2,
80 4, 5, 6, 6, 7, 8, 9, 10, -1, -2
81 };
82
83 fixture.set_input_data(input_a, data_a);
84 fixture.set_input_data(input_b, data_b);
85 fixture.set_input_data(input_c, data_c);
86
87 fixture.execute();
88
89 return fixture.verify_output(cat_result, expected);
90}
91
92bool test_view() {
93 TestUtils::FP16TestFixture fixture("View");

Callers 1

mainFunction · 0.85

Calls 5

create_inputMethod · 0.80
set_input_dataMethod · 0.80
verify_outputMethod · 0.80
catMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected