diff --git a/mindspore/ops/operations/debug_ops.py b/mindspore/ops/operations/debug_ops.py index f575b47377b..f9518122e9b 100644 --- a/mindspore/ops/operations/debug_ops.py +++ b/mindspore/ops/operations/debug_ops.py @@ -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