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

Function test_graph_precision_construction

tests/test_graph.cpp:568–588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

566}
567
568bool test_graph_precision_construction() {
569 TestUtils::FP16TestFixture fixture("Graph Precision Construction");
570
571 size_t fp16_id = fixture.create_input({2, 3}, Precision::FP16);
572 size_t fp32_id = fixture.create_input({3, 4}, Precision::FP32);
573
574 const auto& fp16_buffer = fixture.graph().get_output_buffer(fp16_id);
575 const auto& fp32_buffer = fixture.graph().get_output_buffer(fp32_id);
576
577 assert(fp16_buffer.precision == Precision::FP16);
578 assert(fp16_buffer.shape[0] == 2);
579 assert(fp16_buffer.shape[1] == 3);
580 assert(fp16_buffer.byte_size == 12); // 6 elements * 2 bytes
581
582 assert(fp32_buffer.precision == Precision::FP32);
583 assert(fp32_buffer.shape[0] == 3);
584 assert(fp32_buffer.shape[1] == 4);
585 assert(fp32_buffer.byte_size == 48);
586
587 return true;
588}
589
590bool test_precision_conversion() {
591 TestUtils::FP16TestFixture fixture("Precision Conversion");

Callers 1

mainFunction · 0.85

Calls 2

create_inputMethod · 0.80
get_output_bufferMethod · 0.80

Tested by

no test coverage detected