t-vi commented on a change in pull request #6449:
URL: https://github.com/apache/incubator-tvm/pull/6449#discussion_r487268983
##########
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:
Still, I would prefer looking at what the type of `inputs[1]` is and
have an `if`. We should at least know which types are good to leave as is (the
current except block).
----------------------------------------------------------------
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]