Browse Source

modify print operator inputs check

tags/v1.2.0-rc1
buxue 5 years ago
parent
commit
7895262638
1 changed files with 9 additions and 4 deletions
  1. +9
    -4
      mindspore/ops/operations/debug_ops.py

+ 9
- 4
mindspore/ops/operations/debug_ops.py 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




Loading…
Cancel
Save