| 42 | } |
| 43 | |
| 44 | TEST_CASE(softmax) |
| 45 | { |
| 46 | migraphx::shape s{migraphx::shape::float_type, {10, 1000}}; |
| 47 | migraphx::module m; |
| 48 | auto x = m.add_parameter("x", s); |
| 49 | auto softmax = m.add_instruction(migraphx::make_op("softmax", {{"axis", 1}}), x); |
| 50 | m.add_return({softmax}); |
| 51 | run_pass(m); |
| 52 | EXPECT(none_of(migraphx::iterator_for(m), [](auto ins) { return ins->name() == "softmax"; })); |
| 53 | |
| 54 | auto reduces = find_all(migraphx::iterator_for(m), |
| 55 | [&](auto ins) { return migraphx::contains(ins->name(), "reduce"); }); |
| 56 | EXPECT(all_of(reduces, [](auto ins) { |
| 57 | auto axes = ins->get_operator().to_value()["axes"].template to_vector<int64_t>(); |
| 58 | return axes.size() == 1 and axes[0] == 1; |
| 59 | })); |
| 60 | } |
| 61 | |
| 62 | TEST_CASE(softmax_upcast) |
| 63 | { |
nothing calls this directly
no test coverage detected