Browse Source

!13473 raise error when range delta input is 0

From: @lianliguang
Reviewed-by: @zh_qh,@ginfung
Signed-off-by: @zh_qh
tags/v1.2.0-rc1
mindspore-ci-bot Gitee 5 years ago
parent
commit
46c0252833
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      mindspore/nn/layer/math.py

+ 2
- 0
mindspore/nn/layer/math.py 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


Loading…
Cancel
Save