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

Function test_broadcast_shape_compatibility

tests/test_graph.cpp:490–506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

488}
489
490bool test_broadcast_shape_compatibility() {
491 TestUtils::FP16TestFixture fixture("Broadcast Shape Compatibility");
492
493 size_t a_id = fixture.create_input({2, 3});
494 size_t b_id = fixture.create_input({2, 1});
495
496 std::vector<__fp16> data_a = {1, 2, 3, 4, 5, 6};
497 std::vector<__fp16> data_b = {10, 20};
498 fixture.set_input_data(a_id, data_a);
499 fixture.set_input_data(b_id, data_b);
500
501 size_t result_id = fixture.graph().add(a_id, b_id);
502 fixture.execute();
503
504 std::vector<__fp16> expected = {11, 12, 13, 24, 25, 26};
505 return fixture.verify_output(result_id, expected);
506}
507
508bool test_broadcast_scalar_tensor() {
509 TestUtils::FP16TestFixture fixture("Broadcast Scalar Tensor");

Callers 1

mainFunction · 0.85

Calls 5

create_inputMethod · 0.80
set_input_dataMethod · 0.80
verify_outputMethod · 0.80
addMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected