| 155 | |
| 156 | template <typename T> |
| 157 | void register_format_rule(ValueRefList (*rule)( |
| 158 | const T&, Span<ValueRef>&, const bool&, const FormatTransformation&)) { |
| 159 | format_rules[T::typeinfo()] = [rule](const OpDef& def, Span<ValueRef>& inputs, |
| 160 | const bool& auto_convert, |
| 161 | const FormatTransformation& t) { |
| 162 | return (*rule)(def.cast_final_safe<T>(), inputs, auto_convert, t); |
| 163 | }; |
| 164 | } |
| 165 | |
| 166 | inline auto convert_nchw2nhwc_pattern(const std::vector<int32_t>& pattern) { |
| 167 | mgb_assert(pattern.size() == 4); |