From 4ed56e9dc660cf5c1ddb4b7cc69ebb5742ab86e6 Mon Sep 17 00:00:00 2001 From: Haichen Shen Date: Tue, 19 Feb 2019 17:18:08 -0800 Subject: [PATCH] don't allow empty output from arange --- src/relay/op/tensor/transform.cc | 2 +- tests/python/relay/test_op_level3.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/relay/op/tensor/transform.cc b/src/relay/op/tensor/transform.cc index 899f5c3a67851..b3cb0557ebb6e 100644 --- a/src/relay/op/tensor/transform.cc +++ b/src/relay/op/tensor/transform.cc @@ -892,7 +892,7 @@ bool ArangeRel(const Array& 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()) { - 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; diff --git a/tests/python/relay/test_op_level3.py b/tests/python/relay/test_op_level3.py index 8329ee24ad8b2..e762c7d3a1a08 100644 --- a/tests/python/relay/test_op_level3.py +++ b/tests/python/relay/test_op_level3.py @@ -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__":