kevinthesun commented on a change in pull request #6449:
URL: https://github.com/apache/incubator-tvm/pull/6449#discussion_r487260165
##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -364,7 +438,11 @@ def _impl(inputs, input_types):
def _topk():
def _impl(inputs, input_types):
data = inputs[0]
- k = int(inputs[1])
+ try:
+ k = int(_infer_value(inputs[1], {}).asnumpy().tolist())
+ k = _expr.const(k)
+ except Exception:
+ k = inputs[1]
Review comment:
The try except block is mainly for _infer_value. Currently there is no
very secure way to try _infer_value with explicit error types. That's why a
general Exception is used here.
----------------------------------------------------------------
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:
[email protected]