forked from mindspore-Ecosystem/mindspore
!11108 modify print operator inputs check
From: @zhangbuxue Reviewed-by: @ginfung,@zh_qh Signed-off-by: @zh_qh
This commit is contained in:
commit
08887a066b
|
@ -331,8 +331,8 @@ class Print(PrimitiveWithInfer):
|
||||||
In pynative mode, please use python print function.
|
In pynative mode, please use python print function.
|
||||||
|
|
||||||
Inputs:
|
Inputs:
|
||||||
- **input_x** (Union[Tensor, str]) - The graph node to attach to. The input supports
|
- **input_x** (Union[Tensor, bool, int, float, str, tuple, list]) - The graph node to attach to.
|
||||||
multiple strings and tensors which are separated by ','.
|
The input supports multiple strings and tensors which are separated by ','.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
@ -370,8 +370,13 @@ class Print(PrimitiveWithInfer):
|
||||||
return [1]
|
return [1]
|
||||||
|
|
||||||
def infer_dtype(self, *inputs):
|
def infer_dtype(self, *inputs):
|
||||||
for dtype in inputs:
|
for ele in inputs:
|
||||||
validator.check_subclass("input", dtype, (mstype.tensor, mstype.string), self.name)
|
if isinstance(ele, (tuple, list)):
|
||||||
|
self.infer_dtype(*ele)
|
||||||
|
else:
|
||||||
|
validator.check_subclass("input", ele,
|
||||||
|
[mstype.tensor, mstype.int_, mstype.float_, mstype.bool_, mstype.string],
|
||||||
|
self.name)
|
||||||
return mstype.int32
|
return mstype.int32
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue