Browse Source

!27906 update tensor api document

Merge pull request !27906 from huangbingjian/code_docs_update_api
tags/v1.6.0
i-robot Gitee 4 years ago
parent
commit
2901cb2fc4
2 changed files with 20 additions and 17 deletions
  1. +10
    -10
      docs/api/api_python/mindspore/mindspore.Tensor.rst
  2. +10
    -7
      mindspore/python/mindspore/common/tensor.py

+ 10
- 10
docs/api/api_python/mindspore/mindspore.Tensor.rst View File

@@ -50,7 +50,7 @@ mindspore.Tensor

**返回:**

张量,含有每个元素的绝对值
Tensor

**支持平台:**

@@ -70,12 +70,12 @@ mindspore.Tensor

**参数:**

- **axis** (Union[None, int, tuple(int)) - 被简化的维度。 当 `axis` 为None或者空元组的时候,简化所有维度。 默认值:()。
- **keep_dims** (bool) - 是否会保留被简化的维度。 默认值: False。
- **axis** (Union[None, int, tuple(int)) - 缩减的维度。 当 `axis` 为None或者空元组的时候,缩减所有维度。当 `axis` 为int或tuple(int)时,记Tensor的维度为dim,则其取值范围为[-dim, dim)。默认值:()。
- **keep_dims** (bool) - 是否在输出Tensor中保留缩减的维度。 默认值: False。

**返回:**

Tensor。如果在指定轴方向上所有数组元素都为True,则其值为True,否则其值为False。如果轴为None或空元组,则简化所有维度。
Tensor。如果在指定轴方向上所有数组元素都为True,则其值为True,否则其值为False。如果轴为None或空元组,则缩减所有维度。

**支持平台:**

@@ -95,12 +95,12 @@ mindspore.Tensor

**参数:**

- **axis** (Union[None, int, tuple(int)) - 简化的维度。当轴为None或空元组时,简化所有维度。默认值:()。
- **keep_dims** (bool) - 表示是否保留简化后的维度。默认值:False。
- **axis** (Union[None, int, tuple(int)) - 缩减的维度。当 `axis` 为None或空元组时,缩减所有维度。当 `axis` 为int或tuple(int)时,记Tensor的维度为dim,则其取值范围为[-dim, dim)。默认值:()。
- **keep_dims** (bool) - 是否在输出Tensor中保留缩减的维度。默认值:False。

**返回:**

Tensor。如果在指定轴方向上所有Tensor元素都为True,则其值为True,否则其值为False。如果轴为None或空元组,则简化所有维度。
Tensor。如果在指定轴方向上所有Tensor元素都为True,则其值为True,否则其值为False。如果轴为None或空元组,则缩减所有维度。

**支持平台:**

@@ -660,12 +660,12 @@ mindspore.Tensor

.. py:method:: mean(axis=(), keep_dims=False)

计算指定维度上所有元素的均值,简化Tensor的维度。
计算指定维度上所有元素的均值,缩减Tensor的维度。

**参数:**

- **axis** (Union[None, int, tuple(int), list(int)]) - 简化的维度。当轴为None或空元组时,简化所有维度。默认值:()。
- **keep_dims** (bool) - 表示是否保留简化后的维度。默认值:False。
- **axis** (Union[None, int, tuple(int), list(int)]) - 缩减的维度。当 `axis` 为None或空元组时,缩减所有维度。当 `axis` 为int、tuple(int)或list(int)时,记Tensor的维度为dim,则其取值范围为[-dim, dim)。默认值:()。
- **keep_dims** (bool) - 是否在输出Tensor中保留缩减的维度。。默认值:False。

**返回:**



+ 10
- 7
mindspore/python/mindspore/common/tensor.py View File

@@ -506,8 +506,9 @@ class Tensor(Tensor_):
Check all tensor elements along a given axis evaluate to True.

Args:
axis (Union[None, int, tuple(int)]): Dimensions of reduction,
when the axis is None or empty tuple, reduce all dimensions. Default: ().
axis (Union[None, int, tuple(int)]): Dimensions of reduction.
When the axis is None or empty tuple, reduce all dimensions. When the axis is int or
tuple(int), if the dimension of Tensor is dim, the value range is [-dim, dim). Default: ().
keep_dims (bool): Whether to keep the reduced dimensions. Default: False.

Returns:
@@ -538,8 +539,9 @@ class Tensor(Tensor_):
Check any tensor element along a given axis evaluate to True.

Args:
axis (Union[None, int, tuple(int)]): Dimensions of reduction,
when the axis is None or empty tuple, reduce all dimensions. Default: ().
axis (Union[None, int, tuple(int)]): Dimensions of reduction.
When the axis is None or empty tuple, reduce all dimensions. When the axis is int or
tuple(int), if the dimension of Tensor is dim, the value range is [-dim, dim). Default: ().
keep_dims (bool): Whether to keep the reduced dimensions. Default: False.

Returns:
@@ -624,7 +626,7 @@ class Tensor(Tensor_):
Return absolute value element-wisely.

Returns:
Tensor, with absolute value element-wisely.
Tensor.

Supported Platforms:
``Ascend`` ``GPU`` ``CPU``
@@ -644,8 +646,9 @@ class Tensor(Tensor_):
Reduce a dimension of a tensor by averaging all elements in the dimension.

Args:
axis (Union[None, int, tuple(int), list(int)]): Dimensions of reduction,
when the axis is None or empty tuple, reduce all dimensions. Default: ().
axis (Union[None, int, tuple(int), list(int)]): Dimensions of reduction.
When the axis is None or empty tuple, reduce all dimensions. When the axis is int, tuple(int) or
list(int), if the dimension of Tensor is dim, the value range is [-dim, dim). Default: ().
keep_dims (bool): Whether to keep the reduced dimensions. Default: False.

Returns:


Loading…
Cancel
Save