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 19:54:42 UTC

[GitHub] [tvm] dlexplorer opened a new issue #7096: Missmatching of undefined shape value relay.Any() vs -1

dlexplorer opened a new issue #7096:
URL: https://github.com/apache/tvm/issues/7096


   Many frameworks define dynamism in the shape as -1 in the certain axis while TVM has its own constant for this - relay.Any().
   If I take onnx bert model and try to convert like below snippet code, TVM will crash.
   Two issues
   1. not crash
   2. During conversion need to identify -1 in the shape and warn that TVM uses its own id for defining of dynamic shape/stop execution
   
   Probably stopping of execution after determination of -1 will solve the crash as well
   
   snippet:
   ```
   import argparse
   import sys
   import onnx
   import tvm
   from tvm import relay
   
   parser = argparse.ArgumentParser(description=
       "Converts and compiles ONNX model")
   required = parser.add_argument_group('required arguments')
   required.add_argument('-m', '--input_model', required=True, type=str, help="path to ONNX model")
   args = parser.parse_args()
   
   onnx_model = onnx.load(args.input_model)
   shape_dict = {}
   shape_dict["input_mask:0"] = [-1,256]
   shape_dict["segment_ids:0"] = [-1,256]
   shape_dict["input_ids:0"] = [-1,256]
   shape_dict["unique_ids_raw_output___9:0"] = [-1,256]
   
   mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)
   
   target = "llvm"
   
   with tvm.transform.PassContext(opt_level=3):
       lib = relay.build(mod, target=target, target_host=target, params=params)
   
   lib.export_library(args.input_model + ".so")                                                           
   ```


----------------------------------------------------------------
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



[GitHub] [tvm] zhiics closed issue #7096: Missmatching of undefined shape value relay.Any() vs -1

Posted by GitBox <gi...@apache.org>.
zhiics closed issue #7096:
URL: https://github.com/apache/tvm/issues/7096


   


----------------------------------------------------------------
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



[GitHub] [tvm] dlexplorer edited a comment on issue #7096: Missmatching of undefined shape value relay.Any() vs -1

Posted by GitBox <gi...@apache.org>.
dlexplorer edited a comment on issue #7096:
URL: https://github.com/apache/tvm/issues/7096#issuecomment-743966765


   I disagree with closing this ticket
   1. it is bad from user's experience perspective. If you do not expect to accept some values in to the one function but expect to another - verify the input and return error code and clear message to user what to do
   2. applications must not crash


----------------------------------------------------------------
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



[GitHub] [tvm] zhiics commented on issue #7096: Missmatching of undefined shape value relay.Any() vs -1

Posted by GitBox <gi...@apache.org>.
zhiics commented on issue #7096:
URL: https://github.com/apache/tvm/issues/7096#issuecomment-743773075


   You have to use relay VM to compile dynamic models. 


----------------------------------------------------------------
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



[GitHub] [tvm] dlexplorer commented on issue #7096: Missmatching of undefined shape value relay.Any() vs -1

Posted by GitBox <gi...@apache.org>.
dlexplorer commented on issue #7096:
URL: https://github.com/apache/tvm/issues/7096#issuecomment-743966765


   I disagree with closing this ticket
   1. it is bad from user's perspective. If you do not expect to accept some values in to the one function but expect to another - verify the input and return error code and clear message to user what to do
   2. applications must not crash


----------------------------------------------------------------
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