Skip to content

Commit

Permalink
don't allow empty output from arange
Browse files Browse the repository at this point in the history
  • Loading branch information
icemelon committed Feb 20, 2019
1 parent 017a2c3 commit 4ed56e9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion src/relay/op/tensor/transform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ bool ArangeRel(const Array<Type>& types,
IndexExpr num_elem = tvm::cast(tvm::Int(32), tvm::ceil(
tvm::cast(tvm::Float(32), param->stop - param->start) / param->step));
if (const tvm::ir::IntImm* val = num_elem.as<tvm::ir::IntImm>()) {
CHECK_GE(val->value, 0) << "Invalid arange inputs";
CHECK_GT(val->value, 0) << "Invalid arange inputs";
}
reporter->Assign(types[0], TensorTypeNode::make({num_elem}, param->dtype));
return true;
Expand Down
1 change: 0 additions & 1 deletion tests/python/relay/test_op_level3.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,6 @@ def verify_arange(start, stop, step):
verify_arange(1, 20, 3)
verify_arange(20, 1, -1)
verify_arange(20, 1, -1.5)
verify_arange(5, 5, 1)


if __name__ == "__main__":
Expand Down

0 comments on commit 4ed56e9

Please sign in to comment.