!11108 modify print operator inputs check

From: @zhangbuxue
Reviewed-by: @ginfung,@zh_qh
Signed-off-by: @zh_qh
This commit is contained in:
mindspore-ci-bot 2021-01-11 14:05:04 +08:00 committed by Gitee
commit 08887a066b
1 changed files with 9 additions and 4 deletions

View File

@ -331,8 +331,8 @@ class Print(PrimitiveWithInfer):
In pynative mode, please use python print function.
Inputs:
- **input_x** (Union[Tensor, str]) - The graph node to attach to. The input supports
multiple strings and tensors which are separated by ','.
- **input_x** (Union[Tensor, bool, int, float, str, tuple, list]) - The graph node to attach to.
The input supports multiple strings and tensors which are separated by ','.
Supported Platforms:
``Ascend``
@ -370,8 +370,13 @@ class Print(PrimitiveWithInfer):
return [1]
def infer_dtype(self, *inputs):
for dtype in inputs:
validator.check_subclass("input", dtype, (mstype.tensor, mstype.string), self.name)
for ele in inputs:
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