sunggg commented on code in PR #14282:
URL: https://github.com/apache/tvm/pull/14282#discussion_r1136393998
##########
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:
Do you mean these lines?
```
// define symbolic variables
Array<PrimExpr> shape_var;
for (int i = 0; i < sinfo->ndim; i++) {
shape_var.push_back(tir::Var("x", DataType::Int(64)));
}
```
Initially, I also wanted to support the unknown rank but realized it is
trickier than I thought.
The problem is you need to insert these symbolic variables at compile-time
so we need this info.
--
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]