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

Function test_matrix_multiplication

tests/test_graph.cpp:187–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187bool test_matrix_multiplication() {
188 TestUtils::FP16TestFixture fixture("Matrix Multiplication");
189
190 size_t input_a = fixture.create_input({2, 3});
191 size_t input_b = fixture.create_input({3, 2});
192 size_t matmul_result = fixture.graph().matmul(input_a, input_b, false);
193
194 std::vector<__fp16> data_a = {1, 2, 3, 4, 5, 6};
195 std::vector<__fp16> data_b = {1, 2, 3, 4, 5, 6};
196 fixture.set_input_data(input_a, data_a);
197 fixture.set_input_data(input_b, data_b);
198 fixture.execute();
199
200 std::vector<__fp16> expected = {22, 28, 49, 64};
201 return fixture.verify_output(matmul_result, expected);
202}
203
204bool test_transpose() {
205 TestUtils::FP16TestFixture fixture("Transpose");

Callers 1

mainFunction · 0.85

Calls 5

create_inputMethod · 0.80
matmulMethod · 0.80
set_input_dataMethod · 0.80
verify_outputMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected