raise valueerror when range ops input delat is 0

This commit is contained in:
LianLiguang 2021-03-17 15:31:08 +08:00
parent 93f64e38dd
commit 9481bd6e23
1 changed files with 2 additions and 0 deletions

View File

@ -137,6 +137,8 @@ class Range(Cell):
def __init__(self, start, limit=None, delta=1):
super(Range, self).__init__()
if delta == 0:
raise ValueError("The input of `delta` can not be equal to zero.")
data = np.arange(start, limit, delta)
if data.dtype == np.float:
self.ms_dtype = mstype.float32