mbrookhart commented on a change in pull request #6008:
URL: https://github.com/apache/incubator-tvm/pull/6008#discussion_r452335179



##########
File path: python/tvm/relay/op/algorithm.py
##########
@@ -82,9 +84,12 @@ def topk(data, k=1, axis=-1, ret_type="both",
     out : relay.Expr or List[relay.Expr]
         The computed result.
     """
-    if isinstance(k, int):
-        k = const(k, "int64")
-    out = _make.topk(data, k, axis, ret_type, is_ascend, dtype)
+    if isinstance(k, Constant):
+        k = np.asscalar(k.data.asnumpy())
+    if isinstance(k, Expr):

Review comment:
       Yeah, I think this is a bit of complexity around how @icemelon9 and co 
implemented dynamic shapes in Relay. Basically, any op can take in `Any` 
shapes, at which point the graph becomes un-runable on the graph runtime and 
has to be executed through the VM. 
   
   As @kevinthesun said, what we've been working on recently is allowing for 
non-constant attributes, the `dyn` namespace is mostly to make non-constant 
attributes explicit. If we need to separate all dynamic shapes, I think we'd 
need to implement a `vm` specific op namespace, and I'm not sure we want to go 
that far?




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


Reply via email to