MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / unify_inputs_format

Function unify_inputs_format

imperative/src/impl/transformations/format.cpp:447–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445}
446
447inline ValueRefList unify_inputs_format(
448 const Span<ValueRef>& inputs, const FT& dst_fmt, const std::string& scope,
449 const FormatTransformation& t) {
450 ValueRefList unified_inputs(inputs.size());
451 for (size_t i = 0; i < inputs.size(); ++i) {
452 auto&& inp = inputs[i].cast(t.value_type());
453 if (inp.format() != dst_fmt && if_convert_format(inp.format(), dst_fmt)) {
454 unified_inputs[i] = t.to(inp, dst_fmt, scope);
455 } else {
456 unified_inputs[i] = inputs[i];
457 }
458 }
459 return unified_inputs;
460}
461
462ValueRefList elemwise_rule(
463 const Elemwise& op, Span<ValueRef>& inputs, const bool& auto_convert,

Callers 3

elemwise_ruleFunction · 0.85
concat_ruleFunction · 0.85
apply_transformationMethod · 0.85

Calls 5

if_convert_formatFunction · 0.85
sizeMethod · 0.45
castMethod · 0.45
formatMethod · 0.45
toMethod · 0.45

Tested by

no test coverage detected