From 529fff56ec6848d48e5130cc1c161639f0901657 Mon Sep 17 00:00:00 2001 From: hw_hz Date: Fri, 9 Dec 2022 10:51:20 +0800 Subject: [PATCH] FillV2 docs --- .../api/api_python/ops/mindspore.ops.FillV2.rst | 13 ++++++------- .../mindspore/ops/operations/array_ops.py | 17 ++++++++--------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/docs/api/api_python/ops/mindspore.ops.FillV2.rst b/docs/api/api_python/ops/mindspore.ops.FillV2.rst index 0e96b2bcc8a..105c74369ee 100644 --- a/docs/api/api_python/ops/mindspore.ops.FillV2.rst +++ b/docs/api/api_python/ops/mindspore.ops.FillV2.rst @@ -6,17 +6,16 @@ mindspore.ops.FillV2 创建一个Tensor,其shape由 `shape` 指定,其值则由 `value` 进行填充。 输入: - - **shape** (Tensor) - 1-D Tensor,指定了输出Tensor的shape。 + - **shape** (Union[Tuple[int], Tensor[int]) - 1-D Tensor或Tuple,指定了输出Tensor的shape。 其数据类型必须是int32或int64。 - - **value** (Tensor) - 一个标量Tensor,其值用于填充输出Tensor。 - `value` 必须是0-D的,且其数据类型必须是以下之一: - bool、int8、int16、int32、int64、uint8、uint16、uint32、uint64、float16、float32、float64。 + - **value** (Tensor) - `value` 是Scalar Tensor,其值用于填充输出 `y` , + 其数据类型必须是以下之一:bool、int8、int16、int32、int64、uint8、uint16、uint32、uint64、 + float16、float32、float64、complex64、complex128。 输出: - **y** (Tensor) - Tensor,其shape和值如上所述。 异常: - - **ValueError** - 如果 `shape` 不是1-D Tensor。 + - **TypeError** - 如果 `shape` 不是1-D Tensor或Tuple。 - **TypeError** - 如果 `shape` 的数据类型不是int32或者int64。 - - **ValueError** - 如果 `value` 不是0-D Tensor。 - - **ValueError** - 如果输出元素的数量多于1000000。 + - **ValueError** - 如果 `value` 不是Scalar Tensor。 diff --git a/mindspore/python/mindspore/ops/operations/array_ops.py b/mindspore/python/mindspore/ops/operations/array_ops.py index d85c280a5e0..1c74b7deb63 100755 --- a/mindspore/python/mindspore/ops/operations/array_ops.py +++ b/mindspore/python/mindspore/ops/operations/array_ops.py @@ -1525,20 +1525,19 @@ class FillV2(PrimitiveWithCheck): Creates a tensor with shape described by `shape` and fills it with values in `value` . Inputs: - - **shape** (tensor) - 1-D Tensor, the specified shape of output tensor. - It's dtype must be int32 or int64. - - **value** (tensor) - A scalar tensor, the value to fill the output tensor. - The shape of `value` must be 0D and it's dtype must be one of the following types: - bool, int8, int16, int32, int64, uint8, uint16, uint32, uint64, float16, float32, float64. + - **shape** (Union[Tuple[int], Tensor[int]]) - 1-D Tensor or Tuple, specify the shape + of output tensor. Its dtype must be int32 or int64. + - **value** (Tensor) - A scalar tensor, the value to fill the output tensor `y` . + Its dtype must be one of the following types: bool, int8, int16, int32, int64, + uint8, uint16, uint32, uint64, float16, float32, float64, complex64, complex128. Outputs: - - **y** (Tensor) - A tensor, it's shape and value are described above. + - **y** (Tensor) - A tensor, its shape and value are described above. Raises: - ValueError: If `shape` is not a 1-D tensor. + TypeError: If `shape` is not a 1-D tensor or tuple. TypeError: If the data type of `shape` is not int32 or int64. - ValueError: If `value` is not a 0-D tensor. - ValueError: If the number of output elements is greater than 1000000. + ValueError: If `value` is not a scalar tensor. Supported Platforms: ``Ascend`` ``GPU`` ``CPU``