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

Function test_complex_graph_structure

tests/test_graph.cpp:963–985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

961}
962
963bool test_complex_graph_structure() {
964 TestUtils::FP16TestFixture fixture("Complex Graph Structure");
965
966 size_t input_a = fixture.create_input({2, 2});
967 size_t input_b = fixture.create_input({2, 2});
968 size_t input_c = fixture.create_input({2, 2});
969
970 size_t add_ab = fixture.graph().add(input_a, input_b);
971 size_t mul_result = fixture.graph().multiply(add_ab, input_c);
972 size_t scalar_result = fixture.graph().scalar_add(mul_result, 1.0f);
973
974 std::vector<__fp16> data_a = {1, 2, 3, 4};
975 std::vector<__fp16> data_b = {2, 3, 4, 5};
976 std::vector<__fp16> data_c = {2, 2, 2, 2};
977 fixture.set_input_data(input_a, data_a);
978 fixture.set_input_data(input_b, data_b);
979 fixture.set_input_data(input_c, data_c);
980
981 fixture.execute();
982
983 std::vector<__fp16> expected = {7, 11, 15, 19};
984 return fixture.verify_output(scalar_result, expected);
985}
986
987bool test_multiple_outputs() {
988 TestUtils::FP16TestFixture fixture("Multiple Outputs");

Callers 1

mainFunction · 0.85

Calls 7

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

Tested by

no test coverage detected