| 460 | } |
| 461 | |
| 462 | ValueRefList elemwise_rule( |
| 463 | const Elemwise& op, Span<ValueRef>& inputs, const bool& auto_convert, |
| 464 | const FormatTransformation& t) { |
| 465 | FT format = get_inputs_format(inputs, t); |
| 466 | if (format == FT::NHWC && auto_convert) { |
| 467 | ValueRefList unified_inputs(inputs.size()); |
| 468 | for (size_t i = 0; i < inputs.size(); ++i) { |
| 469 | auto&& inp = inputs[i].cast(t.value_type()); |
| 470 | if (inp.format() != FT::NHWC && inp.value().is_scalar()) { |
| 471 | unified_inputs[i] = t.value_type().make(inp.value(), FT::NHWC); |
| 472 | } else { |
| 473 | unified_inputs[i] = inputs[i]; |
| 474 | } |
| 475 | } |
| 476 | unified_inputs = unify_inputs_format(unified_inputs, FT::NHWC, op.scope(), t); |
| 477 | return t.wrap_outputs( |
| 478 | imperative::apply(op, t.unwrap_inputs(unified_inputs)), format); |
| 479 | } |
| 480 | return t.wrap_outputs(imperative::apply(op, t.unwrap_inputs(inputs)), format); |
| 481 | } |
| 482 | |
| 483 | ValueRefList concat_rule( |
| 484 | const Concat& op, Span<ValueRef>& inputs, const bool& auto_convert, |
nothing calls this directly
no test coverage detected