| 234 | } |
| 235 | |
| 236 | ValueRefList reshape_rule( |
| 237 | const Reshape& reshape, Span<ValueRef> inputs, Span<bool> inputs_mask, |
| 238 | const Type<ScalarValue>& scalar_type) { |
| 239 | mgb_assert(inputs.size() == 1 || inputs.size() == 2); |
| 240 | size_t nr_inp = inputs.size(); |
| 241 | bool is_scalar = (nr_inp == 2 && is_scalar_shape(inputs[1])) || |
| 242 | (nr_inp == 1 && reshape.shape.size() == 0); |
| 243 | if (is_scalar) { |
| 244 | return {scalar_type.make(imperative::apply( |
| 245 | reshape, inputs[0], make_scalar_shape(*inputs[0].device()))[0])}; |
| 246 | } else { |
| 247 | return imperative::apply(reshape, inputs); |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | ValueRefList broadcast_rule( |
| 252 | const Broadcast& broadcast, Span<ValueRef> inputs, Span<bool> inputs_mask, |
nothing calls this directly
no test coverage detected