// Copyright (c) ONNX Project Contributors /* * SPDX-License-Identifier: Apache-2.0 */ // Default converter for ONNX models between different opset versions // in the default domain ("" or "ai.onnx"). #pragma once #include #include #include #include #include #include #include "onnx/version_converter/BaseConverter.h" #include "onnx/version_converter/adapters/axes_attribute_to_input.h" #include "onnx/version_converter/adapters/axes_input_to_attribute.h" #include "onnx/version_converter/adapters/axis_attribute_to_input.h" #include "onnx/version_converter/adapters/axis_input_to_attribute.h" #include "onnx/version_converter/adapters/batch_normalization_13_14.h" #include "onnx/version_converter/adapters/broadcast_backward_compatibility.h" #include "onnx/version_converter/adapters/broadcast_forward_compatibility.h" #include "onnx/version_converter/adapters/cast_9_8.h" #include "onnx/version_converter/adapters/clip_10_11.h" #include "onnx/version_converter/adapters/compatible.h" #include "onnx/version_converter/adapters/dropout_11_12.h" #include "onnx/version_converter/adapters/extend_supported_types.h" #include "onnx/version_converter/adapters/gemm_6_7.h" #include "onnx/version_converter/adapters/gemm_7_6.h" #include "onnx/version_converter/adapters/gridsample_19_20.h" #include "onnx/version_converter/adapters/group_normalization_20_21.h" #include "onnx/version_converter/adapters/maxpool_8_7.h" #include "onnx/version_converter/adapters/no_previous_version.h" #include "onnx/version_converter/adapters/pad_10_11.h" #include "onnx/version_converter/adapters/q_dq_21_20.h" #include "onnx/version_converter/adapters/reshape_4_5.h" #include "onnx/version_converter/adapters/reshape_5_4.h" #include "onnx/version_converter/adapters/resize_10_11.h" #include "onnx/version_converter/adapters/scan_8_9.h" #include "onnx/version_converter/adapters/scan_9_8.h" #include "onnx/version_converter/adapters/scatter_10_11.h" #include "onnx/version_converter/adapters/slice_9_10.h" #include "onnx/version_converter/adapters/softmax_12_13.h" #include "onnx/version_converter/adapters/split_12_13.h" #include "onnx/version_converter/adapters/split_13_12.h" #include "onnx/version_converter/adapters/split_17_18.h" #include "onnx/version_converter/adapters/sum_8_7.h" #include "onnx/version_converter/adapters/topk_9_10.h" #include "onnx/version_converter/adapters/transformers.h" #include "onnx/version_converter/adapters/type_restriction.h" #include "onnx/version_converter/adapters/upsample_6_7.h" #include "onnx/version_converter/adapters/upsample_8_9.h" #include "onnx/version_converter/adapters/upsample_9_10.h" #include "onnx/version_converter/adapters/upsample_9_8.h" namespace ONNX_NAMESPACE { namespace version_conversion { class DefaultVersionConverter : public BaseVersionConverter { private: bool DEBUG = false; std::pair version_range; bool searchOpDomainMap( const std::unordered_map>& op_domain_map, int64_t curr_version, int64_t step) const { bool up = step == 1; const auto version_it = op_domain_map.find(""); return version_it != op_domain_map.end() && ((version_it->second.find(curr_version) != version_it->second.end() && !up) || (version_it->second.find(curr_version + step) != version_it->second.end() && up)); } void debug(const std::string& str) const { if (DEBUG) std::cerr << str << std::endl; } void assertInVersionRange(int64_t version) const { ONNX_ASSERTM( version >= version_range.first && version <= version_range.second, "Warning: invalid version (must be between %d and %d)", version_range.first, version_range.second); } void assertDefaultDomain(const std::string& initial_domain, const std::string& target_domain) const { ONNX_ASSERTM( (initial_domain == "" || initial_domain == "ai.onnx") && (target_domain == "" || target_domain == "ai.onnx"), "Warning: default onnx version converter can only convert " " between default domain opset versions ('' or 'ai.onnx')\n"); ONNX_ASSERTM(initial_domain == target_domain, "initial_version and target_version must have the same domains"); } void convert_graph(std::shared_ptr g, const OpSetID& initial_version, const OpSetID& target_version) const; public: DefaultVersionConverter() { const std::unordered_map>& versions_map = OpSchemaRegistry::DomainToVersionRange::Instance().Map(); version_range = versions_map.at(""); // Register adapters to the version converter const std::vector all_opschemas = OpSchemaRegistry::get_all_schemas_with_history(); for (const OpSchema& schema : all_opschemas) { all_schemas[schema.Name()][schema.domain()][(int64_t)schema.since_version()] = &schema; } // Iterate through all_schemas to determine NoPreviousVersionAdapters for (auto& op_pair : all_schemas) { const auto default_versions = op_pair.second.find(""); if (default_versions != op_pair.second.end()) { int64_t min_version = version_range.second; for (auto& version_pair : default_versions->second) { if (version_pair.first < min_version) { min_version = version_pair.first; } } if (min_version > 1) { registerAdapter(std::make_unique( op_pair.first, OpSetID(min_version), OpSetID(min_version - 1))); } } } /******** 1 -> 2 ********/ // Missing in this group: GlobalLpPool, LpPool, Pad, Split /******** 2 -> 3 ********/ // Missing in this group: GRU /******** 3 -> 4 ********/ registerAdapter("Concat", 3, 4, SetAttributeIfAbsent(kaxis, 1)); /******** 4 -> 3 ********/ std::vector concat_unallowed_types = { TensorProto_DataType_INT32, TensorProto_DataType_INT64, TensorProto_DataType_UINT32, TensorProto_DataType_UINT64, TensorProto_DataType_UINT8, TensorProto_DataType_UINT16, TensorProto_DataType_INT8, TensorProto_DataType_INT16, TensorProto_DataType_STRING, TensorProto_DataType_BOOL}; registerAdapter(std::make_unique("Concat", OpSetID(4), OpSetID(3), concat_unallowed_types)); /******** 4 -> 5 ********/ registerAdapter(std::make_unique()); /******** 5 -> 4 ********/ registerAdapter(std::make_unique()); /******** 5 -> 6 ********/ // Missing in this group: Cast, Tile auto removeConsumedInputs = RemoveAttribute(kconsumed_inputs); registerAdapter("Add", 5, 6, removeConsumedInputs); registerAdapter("Mul", 5, 6, removeConsumedInputs); registerAdapter(std::make_unique("Gemm", OpSetID(5), OpSetID(6))); registerAdapter("Relu", 5, 6, removeConsumedInputs); registerAdapter("BatchNormalization", 5, 6, removeConsumedInputs); registerAdapter("Sum", 5, 6, removeConsumedInputs); registerAdapter("Dropout", 5, 6, removeConsumedInputs); registerAdapter("Abs", 5, 6, removeConsumedInputs); registerAdapter("Ceil", 5, 6, removeConsumedInputs); registerAdapter("Clip", 5, 6, removeConsumedInputs); registerAdapter("Div", 5, 6, removeConsumedInputs); registerAdapter("Elu", 5, 6, removeConsumedInputs); registerAdapter("Exp", 5, 6, removeConsumedInputs); registerAdapter("Floor", 5, 6, removeConsumedInputs); registerAdapter("HardSigmoid", 5, 6, removeConsumedInputs); registerAdapter("InstanceNormalization", 5, 6, removeConsumedInputs); registerAdapter("LeakyRelu", 5, 6, removeConsumedInputs); registerAdapter("Log", 5, 6, removeConsumedInputs); registerAdapter("Max", 5, 6, removeConsumedInputs); registerAdapter("Mean", 5, 6, removeConsumedInputs); registerAdapter("Min", 5, 6, removeConsumedInputs); registerAdapter("Neg", 5, 6, removeConsumedInputs); registerAdapter("PRelu", 5, 6, removeConsumedInputs); registerAdapter("Reciprocal", 5, 6, removeConsumedInputs); registerAdapter("Selu", 5, 6, removeConsumedInputs); registerAdapter("Sigmoid", 5, 6, removeConsumedInputs); registerAdapter("Sqrt", 5, 6, removeConsumedInputs); registerAdapter("Sub", 5, 6, removeConsumedInputs); registerAdapter("Tanh", 5, 6, removeConsumedInputs); /******** 6 -> 5 ********/ std::vector broadcast_unallowed_types = { TensorProto_DataType_INT32, TensorProto_DataType_INT64, TensorProto_DataType_UINT32, TensorProto_DataType_UINT64}; std::vector int_unallowed_types = { TensorProto_DataType_UINT8, TensorProto_DataType_UINT16, TensorProto_DataType_UINT32, TensorProto_DataType_UINT64, TensorProto_DataType_INT8, TensorProto_DataType_INT16, TensorProto_DataType_INT32, TensorProto_DataType_INT64}; std::vector neg_unallowed_types = { TensorProto_DataType_INT32, TensorProto_DataType_INT8, TensorProto_DataType_UINT16, TensorProto_DataType_INT64}; registerAdapter(std::make_unique("Add", OpSetID(6), OpSetID(5), broadcast_unallowed_types)); registerAdapter(std::make_unique("Mul", OpSetID(6), OpSetID(5), broadcast_unallowed_types)); registerAdapter(std::make_unique("Sub", OpSetID(6), OpSetID(5), broadcast_unallowed_types)); registerAdapter(std::make_unique("Div", OpSetID(6), OpSetID(5), broadcast_unallowed_types)); registerAdapter(std::make_unique("Abs", OpSetID(6), OpSetID(5), int_unallowed_types)); registerAdapter(std::make_unique("Neg", OpSetID(6), OpSetID(5), neg_unallowed_types)); registerAdapter("BatchNormalization", 6, 5, SetAttribute(kconsumed_inputs, std::vector({0, 0}))); registerAdapter(std::make_unique("Gemm", OpSetID(6), OpSetID(5))); registerAdapter(std::make_unique("Relu", OpSetID(6), OpSetID(5))); registerAdapter(std::make_unique("Sum", OpSetID(6), OpSetID(5))); registerAdapter(std::make_unique("Dropout", OpSetID(6), OpSetID(5))); /******** 6 -> 7 ********/ // Missing in this group: And, Equal, Greater, GRU, Less, LSTM, Or, RNN, Upsample, Xor registerAdapter(std::make_unique("Add", OpSetID(6), OpSetID(7))); registerAdapter(std::make_unique("AveragePool", OpSetID(6), OpSetID(7))); registerAdapter(std::make_unique("Div", OpSetID(6), OpSetID(7))); registerAdapter(std::make_unique("Mul", OpSetID(6), OpSetID(7))); registerAdapter(std::make_unique("Pow", OpSetID(6), OpSetID(7))); registerAdapter(std::make_unique("PRelu", OpSetID(6), OpSetID(7))); registerAdapter(std::make_unique("Sub", OpSetID(6), OpSetID(7))); registerAdapter(std::make_unique()); registerAdapter("BatchNormalization", 6, 7, RemoveAttributeNotEq(kis_test, 0)); registerAdapter("Dropout", 6, 7, RemoveAttributeNotEq(kis_test, 0)); registerAdapter(std::make_unique()); /******** 7 -> 6 ********/ registerAdapter(std::make_unique("Add", OpSetID(7), OpSetID(6))); registerAdapter(std::make_unique("Div", OpSetID(7), OpSetID(6))); registerAdapter(std::make_unique("Mul", OpSetID(7), OpSetID(6))); registerAdapter(std::make_unique("Pow", OpSetID(7), OpSetID(6))); registerAdapter(std::make_unique("PRelu", OpSetID(7), OpSetID(6))); registerAdapter(std::make_unique("Sub", OpSetID(7), OpSetID(6))); registerAdapter("BatchNormalization", 7, 6, SetAttribute(kis_test, 1)); registerAdapter("Dropout", 7, 6, SetAttribute(kis_test, 1)); registerAdapter(std::make_unique()); registerAdapter("AveragePool", 7, 6, RemoveAttribute(kcount_include_pad, 0)); /******** 7 -> 8 ********/ registerAdapter(std::make_unique("Max", OpSetID(7), OpSetID(8))); registerAdapter(std::make_unique("Min", OpSetID(7), OpSetID(8))); registerAdapter(std::make_unique("Mean", OpSetID(7), OpSetID(8))); registerAdapter(std::make_unique("Sum", OpSetID(7), OpSetID(8))); registerAdapter(std::make_unique("MaxPool", OpSetID(7), OpSetID(8))); /******** 8 -> 7 ********/ registerAdapter(std::make_unique("Max", OpSetID(8), OpSetID(7))); registerAdapter(std::make_unique("Min", OpSetID(8), OpSetID(7))); registerAdapter(std::make_unique("Mean", OpSetID(8), OpSetID(7))); registerAdapter(std::make_unique()); registerAdapter(std::make_unique()); /******** 8 -> 9 ********/ registerAdapter(std::make_unique("Flatten", OpSetID(8), OpSetID(9))); registerAdapter(std::make_unique("Constant", OpSetID(8), OpSetID(9))); registerAdapter(std::make_unique("MatMul", OpSetID(8), OpSetID(9))); registerAdapter(std::make_unique("Gemm", OpSetID(8), OpSetID(9))); registerAdapter(std::make_unique("PRelu", OpSetID(8), OpSetID(9))); registerAdapter(std::make_unique("Greater", OpSetID(8), OpSetID(9))); registerAdapter(std::make_unique("Less", OpSetID(8), OpSetID(9))); registerAdapter(std::make_unique("Cast", OpSetID(8), OpSetID(9))); registerAdapter("BatchNormalization", 8, 9, RemoveAttribute(kspatial, 1)); registerAdapter(std::make_unique()); registerAdapter(std::make_unique()); /******** 9 -> 8 ********/ registerAdapter(std::make_unique("BatchNormalization", OpSetID(9), OpSetID(8))); registerAdapter(std::make_unique("Flatten", OpSetID(9), OpSetID(8))); registerAdapter(std::make_unique("Constant", OpSetID(9), OpSetID(8))); registerAdapter(std::make_unique("MatMul", OpSetID(9), OpSetID(8))); registerAdapter(std::make_unique("Gemm", OpSetID(9), OpSetID(8))); registerAdapter(std::make_unique("PRelu", OpSetID(9), OpSetID(8))); registerAdapter(std::make_unique("Greater", OpSetID(9), OpSetID(8))); registerAdapter(std::make_unique("Less", OpSetID(9), OpSetID(8))); registerAdapter(std::make_unique()); registerAdapter(std::make_unique()); registerAdapter(std::make_unique()); /******** 9 -> 10 ********/ registerAdapter(std::make_unique("AveragePool", OpSetID(9), OpSetID(10))); registerAdapter(std::make_unique("MaxPool", OpSetID(9), OpSetID(10))); registerAdapter(std::make_unique("Dropout", OpSetID(9), OpSetID(10))); registerAdapter(std::make_unique()); registerAdapter(std::make_unique()); registerAdapter(std::make_unique()); /******** 10 -> 9 ********/ registerAdapter(std::make_unique("Dropout", OpSetID(10), OpSetID(9))); /******** 10 -> 11 ********/ registerAdapter(std::make_unique("ArgMax", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("ArgMin", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("AveragePool", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("Concat", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("Constant", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("Compress", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("Conv", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("ConvTranspose", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("DepthToSpace", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("Equal", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("Flatten", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("Gather", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("Gemm", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("Hardmax", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("If", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("LogSoftmax", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("Loop", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("LpPool", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("MaxPool", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("MaxUnpool", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("NonMaxSuppression", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("OneHot", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("ReduceL1", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("ReduceL2", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("ReduceLogSum", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("ReduceLogSumExp", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("ReduceMax", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("ReduceMean", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("ReduceMin", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("ReduceProd", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("ReduceSum", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("ReduceSumSquare", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("Scan", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("Softmax", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("Slice", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("Split", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("Squeeze", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("TopK", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique("Unsqueeze", OpSetID(10), OpSetID(11))); registerAdapter(std::make_unique()); registerAdapter(std::make_unique()); registerAdapter(std::make_unique()); registerAdapter(std::make_unique()); /******** 11 -> 10 ********/ std::vector equal_unallowed_types = { TensorProto_DataType_UINT8, TensorProto_DataType_UINT16, TensorProto_DataType_UINT32, TensorProto_DataType_UINT64, TensorProto_DataType_INT8, TensorProto_DataType_INT16, TensorProto_DataType_FLOAT16, TensorProto_DataType_FLOAT, TensorProto_DataType_DOUBLE}; registerAdapter(std::make_unique("ArgMax", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("ArgMin", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("AveragePool", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("Concat", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("Constant", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("Conv", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("ConvTranspose", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("Equal", OpSetID(11), OpSetID(10), equal_unallowed_types)); registerAdapter(std::make_unique("Flatten", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("LogSoftmax", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("MaxPool", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("ReduceL1", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("ReduceL2", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("ReduceLogSum", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("ReduceLogSumExp", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("ReduceMax", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("ReduceMean", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("ReduceMin", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("ReduceProd", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("ReduceSum", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("ReduceSumSquare", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("Softmax", OpSetID(11), OpSetID(10))); registerAdapter(std::make_unique("Unsqueeze", OpSetID(11), OpSetID(10))); /******** 11 -> 12 ********/ registerAdapter(std::make_unique("ArgMax", OpSetID(11), OpSetID(12))); registerAdapter(std::make_unique("ArgMin", OpSetID(11), OpSetID(12))); registerAdapter(std::make_unique("BatchNormalization", OpSetID(11), OpSetID(12))); registerAdapter(std::make_unique("Constant", OpSetID(11), OpSetID(12))); registerAdapter(std::make_unique("Clip", OpSetID(11), OpSetID(12))); registerAdapter(std::make_unique("GatherND", OpSetID(11), OpSetID(12))); registerAdapter(std::make_unique("Min", OpSetID(11), OpSetID(12))); registerAdapter(std::make_unique("Max", OpSetID(11), OpSetID(12))); registerAdapter(std::make_unique("MaxPool", OpSetID(11), OpSetID(12))); registerAdapter(std::make_unique("Pow", OpSetID(11), OpSetID(12))); registerAdapter(std::make_unique("ReduceMax", OpSetID(11), OpSetID(12))); registerAdapter(std::make_unique("ReduceMin", OpSetID(11), OpSetID(12))); registerAdapter(std::make_unique()); /******** 12 -> 11 ********/ std::vector maxpool_unallowed_types = {TensorProto_DataType_UINT8, TensorProto_DataType_INT8}; registerAdapter("ArgMax", 12, 11, RemoveAttribute(kselect_last_index, 0)); registerAdapter("ArgMin", 12, 11, RemoveAttribute(kselect_last_index, 0)); registerAdapter(std::make_unique("BatchNormalization", OpSetID(12), OpSetID(11))); registerAdapter(std::make_unique("Clip", OpSetID(12), OpSetID(11), int_unallowed_types)); registerAdapter(std::make_unique("Min", OpSetID(12), OpSetID(11), int_unallowed_types)); registerAdapter(std::make_unique("Max", OpSetID(12), OpSetID(11), int_unallowed_types)); registerAdapter(std::make_unique("MaxPool", OpSetID(12), OpSetID(11), maxpool_unallowed_types)); registerAdapter(std::make_unique("ReduceMax", OpSetID(12), OpSetID(11), maxpool_unallowed_types)); registerAdapter(std::make_unique("ReduceMin", OpSetID(12), OpSetID(11), maxpool_unallowed_types)); /******** 12 -> 13 ********/ registerAdapter(std::make_unique("Abs", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Add", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("ArgMin", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("ArgMax", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Cast", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Ceil", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Clip", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Concat", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Constant", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("DepthToSpace", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("DequantizeLinear", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Div", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Dropout", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Equal", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Erf", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Exp", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Expand", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Flatten", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Floor", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Gather", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("GatherElements", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("GatherND", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Gemm", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Greater", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Hardmax", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Identity", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("If", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("IsNaN", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Less", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Log", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Loop", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("LRN", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("NegativeLogLikelihoodLoss", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("MatMul", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Max", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Mean", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("MeanVarianceNormalization", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Min", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Mod", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Mul", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Neg", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("NonZero", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Pow", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Pad", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("QuantizeLinear", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Reciprocal", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("ReduceL1", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("ReduceL2", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("ReduceLogSum", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("ReduceLogSumExp", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("ReduceMean", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("ReduceMax", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("ReduceMin", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("ReduceProd", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("ReduceSumSquare", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Relu", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Reshape", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Resize", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("ScatterElements", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("ScatterND", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Shape", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Sigmoid", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Sign", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Size", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Slice", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("SoftmaxCrossEntropyLoss", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("SpaceToDepth", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Sqrt", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Sub", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Sum", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Tanh", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Tile", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Transpose", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("ReduceSum", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Squeeze", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique("Unsqueeze", OpSetID(12), OpSetID(13))); registerAdapter(std::make_unique()); registerAdapter(std::make_unique("Softmax")); registerAdapter(std::make_unique("LogSoftmax")); /******** 13 -> 12 ********/ registerAdapter(std::make_unique("Constant", OpSetID(13), OpSetID(12))); registerAdapter(std::make_unique("ReduceSum", OpSetID(13), OpSetID(12))); registerAdapter(std::make_unique("Squeeze", OpSetID(13), OpSetID(12))); registerAdapter(std::make_unique("Unsqueeze", OpSetID(13), OpSetID(12))); registerAdapter(std::make_unique()); /******** 13 -> 14 ********/ registerAdapter(std::make_unique("Add", OpSetID(13), OpSetID(14))); registerAdapter(std::make_unique("CumSum", OpSetID(13), OpSetID(14))); registerAdapter(std::make_unique("Div", OpSetID(13), OpSetID(14))); registerAdapter(std::make_unique("Identity", OpSetID(13), OpSetID(14))); registerAdapter(std::make_unique("Mul", OpSetID(13), OpSetID(14))); registerAdapter(std::make_unique("Relu", OpSetID(13), OpSetID(14))); registerAdapter(std::make_unique("Reshape", OpSetID(13), OpSetID(14))); registerAdapter(std::make_unique("Sub", OpSetID(13), OpSetID(14))); registerAdapter("GRU", 13, 14, SetAttribute(klayout, 0)); registerAdapter("LSTM", 13, 14, SetAttribute(klayout, 0)); registerAdapter("RNN", 13, 14, SetAttribute(klayout, 0)); registerAdapter(std::make_unique()); /******** 14 -> 13 ********/ registerAdapter("GRU", 14, 13, RemoveAttribute(klayout, 0)); registerAdapter("LSTM", 14, 13, RemoveAttribute(klayout, 0)); registerAdapter("RNN", 14, 13, RemoveAttribute(klayout, 0)); /******** 14 -> 15 ********/ registerAdapter(std::make_unique("BatchNormalization", OpSetID(14), OpSetID(15))); registerAdapter(std::make_unique("Pow", OpSetID(14), OpSetID(15))); registerAdapter(std::make_unique("Shape", OpSetID(14), OpSetID(15))); /******** 15 -> 16 ********/ registerAdapter("RoiAlign", 15, 16, SetAttribute(kcoordinate_transformation_mode, "output_half_pixel")); registerAdapter(std::make_unique("ScatterElements", OpSetID(15), OpSetID(16))); registerAdapter(std::make_unique("ScatterND", OpSetID(15), OpSetID(16))); registerAdapter(std::make_unique("Identity", OpSetID(15), OpSetID(16))); registerAdapter(std::make_unique("Loop", OpSetID(15), OpSetID(16))); registerAdapter(std::make_unique("If", OpSetID(15), OpSetID(16))); registerAdapter(std::make_unique("Where", OpSetID(15), OpSetID(16))); registerAdapter(std::make_unique("Scan", OpSetID(15), OpSetID(16))); registerAdapter(std::make_unique("LessOrEqual", OpSetID(15), OpSetID(16))); registerAdapter(std::make_unique("GreaterOrEqual", OpSetID(15), OpSetID(16))); registerAdapter(std::make_unique("LeakyRelu", OpSetID(15), OpSetID(16))); registerAdapter(std::make_unique("PRelu", OpSetID(15), OpSetID(16))); /******** 17 -> 18 ********/ registerAdapter(std::make_unique("Pad", OpSetID(17), OpSetID(18))); registerAdapter(std::make_unique("Resize", OpSetID(17), OpSetID(18))); registerAdapter(std::make_unique("OptionalGetElement", OpSetID(17), OpSetID(18))); registerAdapter(std::make_unique("OptionalHasElement", OpSetID(17), OpSetID(18))); registerAdapter(std::make_unique()); registerAdapter(std::make_unique("ScatterND", OpSetID(17), OpSetID(18))); registerAdapter(std::make_unique("ScatterElements", OpSetID(17), OpSetID(18))); registerAdapter("LpPool", 17, 18, SetAttribute(kceil_mode, 0)); registerAdapter(std::make_unique("ReduceL1", OpSetID(17), OpSetID(18))); registerAdapter(std::make_unique("ReduceL2", OpSetID(17), OpSetID(18))); registerAdapter(std::make_unique("ReduceLogSum", OpSetID(17), OpSetID(18))); registerAdapter(std::make_unique("ReduceLogSumExp", OpSetID(17), OpSetID(18))); registerAdapter(std::make_unique("ReduceMax", OpSetID(17), OpSetID(18))); registerAdapter(std::make_unique("ReduceMean", OpSetID(17), OpSetID(18))); registerAdapter(std::make_unique("ReduceMin", OpSetID(17), OpSetID(18))); registerAdapter(std::make_unique("ReduceProd", OpSetID(17), OpSetID(18))); registerAdapter(std::make_unique("ReduceSumSquare", OpSetID(17), OpSetID(18))); /******** 18 -> 17 ********/ registerAdapter(std::make_unique("ReduceL1", OpSetID(18), OpSetID(17))); registerAdapter(std::make_unique("ReduceL2", OpSetID(18), OpSetID(17))); registerAdapter(std::make_unique("ReduceLogSum", OpSetID(18), OpSetID(17))); registerAdapter(std::make_unique("ReduceLogSumExp", OpSetID(18), OpSetID(17))); registerAdapter(std::make_unique("ReduceMax", OpSetID(18), OpSetID(17))); registerAdapter(std::make_unique("ReduceMean", OpSetID(18), OpSetID(17))); registerAdapter(std::make_unique("ReduceMin", OpSetID(18), OpSetID(17))); registerAdapter(std::make_unique("ReduceProd", OpSetID(18), OpSetID(17))); registerAdapter(std::make_unique("ReduceSumSquare", OpSetID(18), OpSetID(17))); /******** 18 -> 19 ********/ registerAdapter(std::make_unique("Equal", OpSetID(18), OpSetID(19))); registerAdapter(std::make_unique("AveragePool", OpSetID(18), OpSetID(19))); registerAdapter(std::make_unique("Cast", OpSetID(18), OpSetID(19))); registerAdapter(std::make_unique("CastLike", OpSetID(18), OpSetID(19))); registerAdapter(std::make_unique("Constant", OpSetID(18), OpSetID(19))); registerAdapter(std::make_unique("DequantizeLinear", OpSetID(18), OpSetID(19))); registerAdapter(std::make_unique("Identity", OpSetID(18), OpSetID(19))); registerAdapter(std::make_unique("If", OpSetID(18), OpSetID(19))); registerAdapter(std::make_unique("Loop", OpSetID(18), OpSetID(19))); registerAdapter(std::make_unique("Pad", OpSetID(18), OpSetID(19))); registerAdapter(std::make_unique("QuantizeLinear", OpSetID(18), OpSetID(19))); registerAdapter(std::make_unique("Reshape", OpSetID(18), OpSetID(19))); registerAdapter(std::make_unique("Resize", OpSetID(18), OpSetID(19))); registerAdapter(std::make_unique("Scan", OpSetID(18), OpSetID(19))); registerAdapter(std::make_unique("Shape", OpSetID(18), OpSetID(19))); registerAdapter(std::make_unique("Size", OpSetID(18), OpSetID(19))); /******** 19 -> 20 ********/ registerAdapter(std::make_unique("DFT", OpSetID(19), OpSetID(20), 2, 1)); registerAdapter(std::make_unique("ConstantOfShape", OpSetID(19), OpSetID(20))); registerAdapter(std::make_unique("IsInf", OpSetID(19), OpSetID(20))); registerAdapter(std::make_unique("IsNaN", OpSetID(19), OpSetID(20))); registerAdapter(std::make_unique("ReduceMax", OpSetID(19), OpSetID(20))); registerAdapter(std::make_unique("ReduceMin", OpSetID(19), OpSetID(20))); registerAdapter(std::make_unique()); /******** 20 -> 19 ********/ const std::vector is_nan_13_unallowed_types = { TensorProto_DataType_FLOAT8E4M3FN, TensorProto_DataType_FLOAT8E4M3FNUZ, TensorProto_DataType_FLOAT8E5M2, TensorProto_DataType_FLOAT8E5M2FNUZ}; registerAdapter(std::make_unique("IsNaN", OpSetID(20), OpSetID(19), is_nan_13_unallowed_types)); const std::vector is_inf_10_unallowed_types = { TensorProto_DataType_FLOAT16, TensorProto_DataType_BFLOAT16, TensorProto_DataType_FLOAT8E4M3FN, TensorProto_DataType_FLOAT8E4M3FNUZ, TensorProto_DataType_FLOAT8E5M2, TensorProto_DataType_FLOAT8E5M2FNUZ}; registerAdapter(std::make_unique("IsInf", OpSetID(20), OpSetID(19), is_inf_10_unallowed_types)); registerAdapter(std::make_unique("DFT", OpSetID(20), OpSetID(19), 2, -2)); const std::vector reduce_min_max_18_unallowed_types = {TensorProto_DataType_BOOL}; registerAdapter( std::make_unique("ReduceMax", OpSetID(20), OpSetID(19), reduce_min_max_18_unallowed_types)); registerAdapter( std::make_unique("ReduceMin", OpSetID(20), OpSetID(19), reduce_min_max_18_unallowed_types)); /******** 20 -> 21 ********/ registerAdapter(std::make_unique("Cast", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("CastLike", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("Constant", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("ConstantOfShape", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("DequantizeLinear", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("Flatten", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique()); registerAdapter(std::make_unique("Identity", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("If", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("Loop", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("Pad", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("QLinearMatMul", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("QuantizeLinear", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("Reshape", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("Scan", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("Shape", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("Size", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("Squeeze", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("Transpose", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("Unsqueeze", OpSetID(20), OpSetID(21))); registerAdapter(std::make_unique("GroupNormalization", OpSetID(20), OpSetID(21))); /******** 21 -> 20 ********/ const std::vector q_dqmm_20_unallowed_types = { TensorProto_DataType_BFLOAT16, TensorProto_DataType_FLOAT16, TensorProto_DataType_UINT4, TensorProto_DataType_INT4}; const std::vector ir10_types_not_in_ir9 = { TensorProto_DataType_UINT4, TensorProto_DataType_INT4}; const std::vector ir10_types_not_in_ir4 = { TensorProto_DataType_FLOAT8E4M3FN, TensorProto_DataType_FLOAT8E4M3FNUZ, TensorProto_DataType_FLOAT8E5M2, TensorProto_DataType_FLOAT8E5M2FNUZ, TensorProto_DataType_UINT4, TensorProto_DataType_INT4}; registerAdapter(std::make_unique("Cast", OpSetID(21), OpSetID(20), ir10_types_not_in_ir9)); registerAdapter(std::make_unique("CastLike", OpSetID(21), OpSetID(20), ir10_types_not_in_ir9)); registerAdapter(std::make_unique("Constant", OpSetID(21), OpSetID(20), ir10_types_not_in_ir9)); registerAdapter( std::make_unique("ConstantOfShape", OpSetID(21), OpSetID(20), ir10_types_not_in_ir9)); registerAdapter(std::make_unique()); registerAdapter(std::make_unique("Flatten", OpSetID(21), OpSetID(20), ir10_types_not_in_ir4)); registerAdapter(std::make_unique("Identity", OpSetID(21), OpSetID(20), ir10_types_not_in_ir9)); registerAdapter(std::make_unique("If", OpSetID(21), OpSetID(20), ir10_types_not_in_ir9)); registerAdapter(std::make_unique("Loop", OpSetID(21), OpSetID(20), ir10_types_not_in_ir9)); registerAdapter(std::make_unique("Pad", OpSetID(21), OpSetID(20), ir10_types_not_in_ir4)); registerAdapter( std::make_unique("QLinearMatMul", OpSetID(21), OpSetID(20), q_dqmm_20_unallowed_types)); registerAdapter(std::make_unique()); registerAdapter(std::make_unique("Reshape", OpSetID(21), OpSetID(20), ir10_types_not_in_ir9)); registerAdapter(std::make_unique("Scan", OpSetID(21), OpSetID(20), ir10_types_not_in_ir9)); registerAdapter(std::make_unique("Shape", OpSetID(21), OpSetID(20), ir10_types_not_in_ir9)); registerAdapter(std::make_unique("Size", OpSetID(21), OpSetID(20), ir10_types_not_in_ir9)); registerAdapter(std::make_unique("Squeeze", OpSetID(21), OpSetID(20), ir10_types_not_in_ir4)); registerAdapter(std::make_unique("Transpose", OpSetID(21), OpSetID(20), ir10_types_not_in_ir9)); registerAdapter(std::make_unique("Unsqueeze", OpSetID(21), OpSetID(20), ir10_types_not_in_ir4)); /******** 21 -> 22 ********/ registerAdapter(std::make_unique("EyeLike", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("RandomUniform", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("RandomNormal", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("RandomUniformLike", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("RandomNormalLike", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Multinomial", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Bernoulli", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("ThresholdedRelu", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Selu", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Elu", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Mish", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("HardSigmoid", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("HardSwish", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Softsign", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Softplus", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Sin", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Cos", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Tan", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Asin", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Acos", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Atan", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Sinh", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Cosh", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Asinh", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Acosh", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Atanh", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Round", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Det", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("NegativeLogLikelihoodLoss", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("AveragePool", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("MaxPool", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("MaxUnpool", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("LpPool", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("MaxRoiPool", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Conv", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("ConvTranspose", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("DeformConv", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("GlobalAveragePool", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("GlobalMaxPool", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("GlobalLpPool", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("InstanceNormalization", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("LpNormalization", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("Dropout", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("RoiAlign", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("RNN", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("GRU", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("LSTM", OpSetID(21), OpSetID(22))); registerAdapter(std::make_unique("GridSample", OpSetID(21), OpSetID(22))); /******** 22 -> 21 ********/ const std::vector bfloat16_not_allowed = {TensorProto_DataType_BFLOAT16}; registerAdapter(std::make_unique("EyeLike", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("AveragePool", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("MaxPool", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("RandomUniform", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("RandomNormal", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter( std::make_unique("RandomNormalLike", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter( std::make_unique("RandomUniformLike", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Multinomial", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Bernoulli", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter( std::make_unique("ThresholdedRelu", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Selu", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Elu", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Mish", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("HardSigmoid", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("HardSwish", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Softsign", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Softplus", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Sin", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Cos", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Tan", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Asin", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Acos", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Atan", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Sinh", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Cosh", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Asinh", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Acosh", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Atanh", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Round", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Det", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter( std::make_unique("NegativeLogLikelihoodLoss", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("MaxUnpool", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("LpPool", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("MaxRoiPool", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Conv", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("ConvTranspose", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("DeformConv", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter( std::make_unique("GlobalAveragePool", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("GlobalLpPool", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter( std::make_unique("InstanceNormalization", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter( std::make_unique("LpNormalization", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("Dropout", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("RoiAlign", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("RNN", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("GRU", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("LSTM", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); registerAdapter(std::make_unique("GridSample", OpSetID(22), OpSetID(21), bfloat16_not_allowed)); } ModelProto convert_version(const ModelProto& mp_in, const OpSetID& initial_version, const OpSetID& target_version) const override; }; ModelProto ConvertVersion(const ModelProto& mp_in, int target_version); } // namespace version_conversion } // namespace ONNX_NAMESPACE