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

Function test_softmax

tests/test_graph.cpp:337–349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335}
336
337bool test_softmax() {
338 TestUtils::FP16TestFixture fixture("Softmax");
339
340 size_t input_a = fixture.create_input({2, 3});
341 size_t softmax_result = fixture.graph().softmax(input_a, -1);
342
343 std::vector<__fp16> input_data = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f};
344 fixture.set_input_data(input_a, input_data);
345 fixture.execute();
346
347 std::vector<__fp16> expected = {0.09003f, 0.24473f, 0.66524f, 0.09003f, 0.24473f, 0.66524f};
348 return fixture.verify_output(softmax_result, expected, 0.01f);
349}
350
351bool test_attention() {
352 TestUtils::FP16TestFixture fixture("Attention");

Callers 1

mainFunction · 0.85

Calls 5

create_inputMethod · 0.80
set_input_dataMethod · 0.80
verify_outputMethod · 0.80
softmaxMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected