You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/12/11 21:45:11 UTC

[GitHub] [tvm] mbrookhart commented on a change in pull request #7055: Fix shape init for tvmc onnx frontend

mbrookhart commented on a change in pull request #7055:
URL: https://github.com/apache/tvm/pull/7055#discussion_r541325105



##########
File path: python/tvm/relay/frontend/onnx.py
##########
@@ -2737,6 +2737,12 @@ def from_onnx(model, shape=None, dtype="float32", opset=None, freeze_params=Fals
                 warnings.warn(str(e))
     except ImportError:
         pass
+
+    # if no explicit input's shape came from user, then initialize shape as it is defined in onnx model
+    if shape is None:
+        shape = {}
+        for i in model.graph.input:
+            shape[i.name] = [dim.dim_value for dim in i.type.tensor_type.shape.dim]

Review comment:
       I think we need to edit this logic just a little bit. If we have an unspecified input shape in the onnx model, it will show up as a variable, I think we need to identify that case and convert it to relay.Any() here.
   
   For instance, this version of [BERT](https://github.com/mlcommons/inference/tree/master/language/bert) has for one of it's input shapes `[input_ids_dynamic_axes_1,384]` I believe this would fail on those inputs.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org