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

Function test_mean_operations

tests/test_graph.cpp:414–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412}
413
414bool test_mean_operations() {
415 TestUtils::FP16TestFixture fixture("Mean Operations");
416
417 size_t input_a = fixture.create_input({2, 4});
418 size_t mean_all = fixture.graph().mean(input_a, -1);
419 size_t mean_axis0 = fixture.graph().mean(input_a, 0);
420 size_t mean_axis1 = fixture.graph().mean(input_a, 1);
421
422 std::vector<__fp16> data_a = {2, 4, 6, 8, 10, 12, 14, 16};
423 fixture.set_input_data(input_a, data_a);
424 fixture.execute();
425
426 std::vector<__fp16> expected_all = {9};
427 std::vector<__fp16> expected_axis0 = {6, 8, 10, 12};
428 std::vector<__fp16> expected_axis1 = {5, 13};
429
430 return fixture.verify_output(mean_all, expected_all) &&
431 fixture.verify_output(mean_axis0, expected_axis0) &&
432 fixture.verify_output(mean_axis1, expected_axis1);
433}
434
435bool test_variance_operations() {
436 TestUtils::FP16TestFixture fixture("Variance Operations");

Callers 1

mainFunction · 0.85

Calls 5

create_inputMethod · 0.80
meanMethod · 0.80
set_input_dataMethod · 0.80
verify_outputMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected