slyubomirsky commented on code in PR #14282:
URL: https://github.com/apache/tvm/pull/14282#discussion_r1134708023


##########
src/relax/op/op.cc:
##########
@@ -315,6 +315,32 @@ Expr MakeShapeOf(Expr expr) {
 
 TVM_REGISTER_GLOBAL("relax.op.shape_of").set_body_typed(MakeShapeOf);
 
+// tensor_to_shape
+
+StructInfo ReturnTensorToShapeStructInfo(const Call& call, const BlockBuilder& 
ctx) {
+  ICHECK(call->args.size() == 1);
+  ICHECK(call->args[0]->struct_info_.defined());
+  const auto* tsinfo = GetStructInfoAs<TensorStructInfoNode>(call->args[0]);
+  ICHECK(tsinfo && tsinfo->shape.defined());

Review Comment:
   I think this condition is more restrictive than necessary. I think it's okay 
for the shape not to be known at compile time and to return 
`ShapeStructInfo(ndim=-1)` if the input rank/shape is unknown at compile time.
   
   Edit: I guess you use the rank in `vm_builtin_lower.cc` but I don't see why 
it has to be implemented that way. You could check all the necessary properties 
dynamically (inside the builtin)



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to