This is an automated email from the ASF dual-hosted git repository.

sslyu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 47424b374b [Unity] Improve error message in tensor_to_shape struct 
inference (#16473)
47424b374b is described below

commit 47424b374b00b751d5575818374b9bc1712033c3
Author: Eric Lunderberg <lunderb...@users.noreply.github.com>
AuthorDate: Thu Jan 25 19:22:04 2024 -0600

    [Unity] Improve error message in tensor_to_shape struct inference (#16473)
    
    If the tensor argument does not have a valid shape, then the error
    message will include the expression, the argument, and the struct info
    of the argument.
---
 src/relax/op/op.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/relax/op/op.cc b/src/relax/op/op.cc
index f51d2cc74f..489886e50f 100644
--- a/src/relax/op/op.cc
+++ b/src/relax/op/op.cc
@@ -780,7 +780,9 @@ StructInfo ReturnTensorToShapeStructInfo(const Call& call, 
const BlockBuilder& c
   const auto* tsinfo = GetStructInfoAs<TensorStructInfoNode>(call->args[0]);
   ICHECK(tsinfo && tsinfo->shape.defined());
   ShapeExpr shape_expr = Downcast<ShapeExpr>(tsinfo->shape.value());
-  ICHECK(shape_expr->values.size() == 1);
+  ICHECK(shape_expr->values.size() == 1) << "relax.tensor_to_shape expected 
argument to be 1-d, "
+                                         << "but " << call << " has argument " 
<< call->args[0]
+                                         << " with struct info " << 
call->args[0]->struct_info_;
   const IntImmNode* ndim = shape_expr->values[0].as<IntImmNode>();
   ICHECK(ndim);
   return ShapeStructInfo(ndim->value);

Reply via email to