Browse Source

fix no attr name

tags/v1.2.0
chujinjin 5 years ago
parent
commit
195f094c97
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      mindspore/ops/operations/array_ops.py

+ 4
- 4
mindspore/ops/operations/array_ops.py View File

@@ -320,16 +320,16 @@ class Cast(PrimitiveWithInfer):

def check_elim(self, x, dtype):
if isinstance(x, (Tensor, numbers.Number, Parameter)):
if isinstance(x, Parameter):
data = x.data
if data.dtype == dtype:
return (True, x)
if isinstance(x, Tensor) and x.dtype == dtype:
x = Tensor(x)
x.set_cast_dtype()
return (True, x)
if isinstance(x, numbers.Number):
return (True, Tensor(x, dtype=dtype))
if isinstance(x, Parameter):
data = x.data
if data.dtype == dtype:
return (True, x)
return (False, None)

def __infer__(self, x, t):


Loading…
Cancel
Save