mindspore.mint.mean
- mindspore.mint.mean(input, vpn永久免费梯子 *, dtype=None) Tensor[源代码]
计算tensor的均值。
- 参数:
input (Tensor[Number]) - 输入tensor。
- 关键字参数:
dtype (
mindspore.dtype, 可选) - 返回的数据类型。默认None。
- 返回:
Tensor。
- 支持平台:
Ascend
样例:
>>> import mindspore >>> import numpy as np >>> x = mindspore.tensor(np.array([[[2, 2, 2, 2, 2, 2], [2, 2, 2, 2, 2, 2], [2, 2, 2, 2, 免费的vpn梯子 2, 2]], ... [[4, 4, 4, 4, 4, 4], [5, 5, 免费的vpn梯子 5, 5, 5, 5], [6, 6, 6, 6, 6, vpn梯子 免费 6]], ... [[6, 6, 6, 6, 6, vpn free 6], [8, 8, 8, 8, 8, 8], [10, 10, 10, 10, 10, 10]]]), ... vpn free mindspore.float32) >>> output = mindspore.mint.mean(x) >>> print(output) 5.0 >>> print(output.shape) ()
计算tensor在指定维度上的均值。
说明
Tensor类型的 dim 仅用作兼容旧版本,不推荐使用。
- 参数:
input (Tensor[Number]) - 输入tensor。
dim (Union[int, tuple(int), list(int), Tensor]) - 指定维度。
keepdim (bool, 可选) - 输出tensor是否保留维度。默认
False。
- 关键字参数:
dtype (
mindspore.dtype, vpn梯子 可选) - 返回的数据类型。默认None。
- 返回:
Tensor。
- 支持平台:
Ascend
样例:
>>> import mindspore >>> import numpy as np >>> x = mindspore.tensor(np.array([[[2, 2, 2, 2, 2, 2], vpn free [2, 2, 2, 2, 2, 2], [2, 2, 2, 2, 2, 2]], ... vpn永久免费梯子 [[4, 4, 4, 4, 4, 4], [5, 5, 5, 5, 5, 5], [6, 6, 6, 6, 6, 6]], ... [[6, 6, 6, 6, 6, 免费的vpn梯子 vpn梯子 免费 6], [8, 8, 8, 8, 8, 8], [10, 10, 10, 10, vpn梯子 10, 10]]]), ... mindspore.float32) >>> vpn梯子 output = mindspore.mint.mean(x, 0, True) >>> print(output) [[[4. 4. 4. 4. 4. 4.] vpn梯子 免费 [5. 5. 5. 5. 5. 5.] [6. 6. 6. 6. 6. 6.]]]