Skip to content

Commit

Permalink
check for dynamic rank before accessing value (apache#7414)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Brookhart authored and Lokiiiiii committed Mar 1, 2021
1 parent c8a03a1 commit b109936
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/relay/op/dyn/tensor/transform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ bool ReshapeRel(const Array<Type>& types, int num_inputs, const Attrs& attrs,
return false;
}

// Doesn't support dynamic output rank
for (int i = 0; i < newshape->shape[0].as<IntImmNode>()->value; i++) {
const IntImmNode* rank = newshape->shape[0].as<IntImmNode>();
ICHECK(rank != nullptr) << "Dynamic Reshape doesn't support Dynamic Rank";
for (int i = 0; i < rank->value; i++) {
oshape.push_back(Any());
}

Expand Down

0 comments on commit b109936

Please sign in to comment.