| 36 | } |
| 37 | |
| 38 | TEST_CASE(broadcast_with_dims) |
| 39 | { |
| 40 | migraphx::module m0; |
| 41 | { |
| 42 | // the X input |
| 43 | migraphx::shape sx{migraphx::shape::float_type, {3, 1, 1}}; |
| 44 | auto inx = m0.add_parameter("x", sx); |
| 45 | |
| 46 | // the shape input. Broadcast to this |
| 47 | migraphx::shape dims_s{migraphx::shape::int64_type, {4}}; |
| 48 | std::vector<size_t> dims = {2, 3, 4, 5}; |
| 49 | auto out_dims = m0.add_literal(migraphx::literal{dims_s, dims}); |
| 50 | |
| 51 | auto r = m0.add_instruction(migraphx::make_op("broadcast_with_dims"), inx, out_dims); |
| 52 | m0.add_return({r}); |
| 53 | } |
| 54 | run_pass(m0); |
| 55 | |
| 56 | migraphx::module m1; |
| 57 | { |
| 58 | migraphx::shape sx{migraphx::shape::float_type, {3, 1, 1}}; |
| 59 | auto inx = m1.add_parameter("x", sx); |
| 60 | |
| 61 | auto r = m1.add_instruction( |
| 62 | migraphx::make_op("multibroadcast", {{"out_lens", {2, 3, 4, 5}}}), inx); |
| 63 | m1.add_return({r}); |
| 64 | } |
| 65 | EXPECT(m0 == m1); |
| 66 | } |
| 67 | |
| 68 | TEST_CASE(broadcast_with_dims_invalid) |
| 69 | { |
nothing calls this directly
no test coverage detected