zhreshold commented on a change in pull request #11676: MXNet ONNX export - Dot op support URL: https://github.com/apache/incubator-mxnet/pull/11676#discussion_r202187675
########## File path: python/mxnet/contrib/onnx/mx2onnx/_op_translations.py ########## @@ -435,6 +435,101 @@ def convert_pad(node, **kwargs): return [node] +@mx_op.register("dot") +def convert_dot(node, **kwargs): + """Map MXNet's dot operator attributes to onnx's + MatMul and Transpose operators based on the values set for + transpose_a, transpose_b attributes.""" + helper, _, _ = import_onnx_modules() + proc_nodes = kwargs["proc_nodes"] + node_inputs = node["inputs"] + name = node["name"] + + input_a_idx = kwargs["index_lookup"][node_inputs[0][0]] + input_node_a = proc_nodes[input_a_idx].name + input_b_idx = kwargs["index_lookup"][node_inputs[1][0]] + input_node_b = proc_nodes[input_b_idx].name + + # Getting the attributes and assigning default values. + if "attrs" in node: Review comment: Can use two lines for these block: trans_a = int(node.get('attrs', {}).get('transpose_a', 0)) trans_b = int(node.get('attrs', {}).get('transpose_b', 0)) I am not sure if the transpose_a is encoded as string '1' or 'True', if the latter, then it's not valid ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services