diff --git a/python/mxnet/contrib/onnx/mx2onnx/_op_translations.py b/python/mxnet/contrib/onnx/mx2onnx/_op_translations.py index 45cd1848e405..31a410be556a 100644 --- a/python/mxnet/contrib/onnx/mx2onnx/_op_translations.py +++ b/python/mxnet/contrib/onnx/mx2onnx/_op_translations.py @@ -1698,17 +1698,14 @@ def convert_norm(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) mx_axis = attrs.get("axis", None) - axes = convert_string_to_list(str(mx_axis)) if mx_axis is not None else None + axes = convert_string_to_list(str(mx_axis)) if mx_axis else None keepdims = get_boolean_attribute_value(attrs, "keepdims") ord = int(attrs.get("ord", 2)) - if ord == 1: - onnx_op_name = "ReduceL1" - else: - onnx_op_name = "ReduceL2" + onnx_op_name = "ReduceL1" if ord == 1 else "ReduceL2" - if axes is not None: + if axes: reduce_node = onnx.helper.make_node( onnx_op_name, input_nodes, diff --git a/python/mxnet/contrib/onnx/onnx2mx/_op_translations.py b/python/mxnet/contrib/onnx/onnx2mx/_op_translations.py index 798298a0bf3d..ec6bcfee2100 100644 --- a/python/mxnet/contrib/onnx/onnx2mx/_op_translations.py +++ b/python/mxnet/contrib/onnx/onnx2mx/_op_translations.py @@ -747,6 +747,6 @@ def lpnormalization(attrs, inputs, proto_obj): https://github.com/onnx/onnx/pull/1330""" new_attrs = translation_utils._fix_attribute_names(attrs, {'p': 'ord'}) axis = int(attrs.get("axis", -1)) - new_attrs.update(axis=axis) + new_attrs = translation_utils._add_extra_attributes(new_attrs, {'axis', axis}) return 'norm', new_attrs, inputs