mindspore/docs/api/api_python/mint/mindspore.mint.func_sum.rst

34 lines
1.0 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.mint.sum
==================
.. py:function:: mindspore.mint.sum(input, *, dtype=None) -> Tensor
计算tensor所有元素的和。
参数:
- **input** (Tensor) - 输入tensor。
关键字参数:
- **dtype** (:class:`mindspore.dtype`, 可选) - 期望输出tensor的类型。默认 ``None``
返回:
Tensor
.. py:function:: mindspore.mint.sum(input, dim, keepdim=False, *, dtype=None) -> Tensor
:noindex:
计算tensor在指定维度上元素的和。
.. note::
Tensor类型的 `dim` 仅用作兼容旧版本,不推荐使用。
参数:
- **input** (Tensor) - 输入tensor。
- **dim** (Union[int, tuple(int), list(int), Tensor]) - 指定计算维度。
- **keepdim** (bool可选) - 输出tensor是否保留维度。默认 ``False``
关键字参数:
- **dtype** (:class:`mindspore.dtype`, 可选) - 期望输出tensor的类型。默认 ``None``
返回:
Tensor