diff --git a/docs/api/api_python/mindspore/mindspore.Tensor.rst b/docs/api/api_python/mindspore/mindspore.Tensor.rst index 2ae11603840..f29f742382a 100644 --- a/docs/api/api_python/mindspore/mindspore.Tensor.rst +++ b/docs/api/api_python/mindspore/mindspore.Tensor.rst @@ -639,6 +639,7 @@ mindspore.Tensor - **TypeError** - `indices` 不是int或tuple。 - **TypeError** - `indices` 是元组,但是其中的元素不是int。 + - **ValueError** - Tensor的shape与 `v` 的shape不同。 .. py:method:: inplace_sub(v, indices) @@ -660,6 +661,7 @@ mindspore.Tensor - **TypeError** - `indices` 不是int或tuple。 - **TypeError** - `indices` 是元组,但是其中的元素不是int。 + - **ValueError** - Tensor的shape与 `v` 的shape不同。 .. py:method:: inplace_update(v, indices) @@ -681,6 +683,7 @@ mindspore.Tensor - **TypeError** - `indices` 不是int或tuple。 - **TypeError** - `indices` 是元组,但是其中的元素不是int。 + - **ValueError** - Tensor的shape与 `v` 的shape不同。 .. py:method:: intopk(x, k) diff --git a/mindspore/python/mindspore/common/tensor.py b/mindspore/python/mindspore/common/tensor.py index 793dd5e5f4e..3ac3fad2770 100644 --- a/mindspore/python/mindspore/common/tensor.py +++ b/mindspore/python/mindspore/common/tensor.py @@ -2088,6 +2088,11 @@ class Tensor(Tensor_): Returns: Tensor, with updated values. + Raises: + TypeError: if indices is not int or tuple. + TypeError: if indices is tuple but any of its element is not int. + ValueError: the Tensor shape is different from that of v. + Supported Platforms: ``Ascend`` ``CPU`` @@ -2119,6 +2124,11 @@ class Tensor(Tensor_): Returns: Tensor, with values after adding. + Raises: + TypeError: if indices is not int or tuple. + TypeError: if indices is tuple but any of its element is not int. + ValueError: the Tensor shape is different from that of v. + Supported Platforms: ``Ascend`` ``CPU`` @@ -2150,6 +2160,11 @@ class Tensor(Tensor_): Returns: Tensor, with values after subtracting. + Raises: + TypeError: if indices is not int or tuple. + TypeError: if indices is tuple but any of its element is not int. + ValueError: the Tensor shape is different from that of v. + Supported Platforms: ``Ascend`` ``CPU``