safrooze opened a new issue #13407: ONNX export makes incorrect assumption about label names URL: https://github.com/apache/incubator-mxnet/issues/13407 ## Description ONNX implementation in mx2onnx.export_model:export_model() makes multiple incorrect assumptions about the symbolic graph which makes its implementation very fragile to any graph that doesn't fit its assumptions. Incorrect assumptions: 1. Order that data is fed to network is the order that `sym.list_inputs()` lists them: * This is an incorrect assumption because the order data is fed to network (particularly a gluon block) is determined by custom block's API. However the order that data is listed in `sym.list_inputs()` is by the dependency in computation graph. 1. There can be one and only one label in the graph and this label is named after the last node of the graph on sym.get_internals(). * This is clearly an incorrect assumption. Perhaps if the last node is called 'softmax' and the network's label was called 'softmax_label' (which happens to be the default label name) then this assumption will hold. However under any other condition, I don't think this is a valid assumption. A proper implementation would be to change the `export_model()` API to accept a dictionary of `name: shape` for input instead of a list of shapes. Any input that is not in params or in inputs will then be assumed to be a label and may be ignored. However if incorrectly specified as unnecessary label, then ONNX export will fail. For backward compatibility, if a list of shapes is provided as inputs, the current automatic name to shape mapping will happen but a warning log is created, warning user to use a dictionary and also warns about the default mapping between shapes and inputs.
---------------------------------------------------------------- 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