diff --git a/src/relay/op/dyn/tensor/transform.cc b/src/relay/op/dyn/tensor/transform.cc index 8bad3943f5ce..9724a92e8776 100644 --- a/src/relay/op/dyn/tensor/transform.cc +++ b/src/relay/op/dyn/tensor/transform.cc @@ -64,8 +64,9 @@ bool ReshapeRel(const Array& types, int num_inputs, const Attrs& attrs, return false; } - // Doesn't support dynamic output rank - for (int i = 0; i < newshape->shape[0].as()->value; i++) { + const IntImmNode* rank = newshape->shape[0].as(); + ICHECK(rank != nullptr) << "Dynamic Reshape doesn't support Dynamic Rank"; + for (int i = 0; i < rank->value; i++) { oshape.push_back(Any()); }