!37618 Add Chinese API doc to SquareSumAll op and update example

Merge pull request !37618 from TinaMengtingZhang/fix_api_doc
This commit is contained in:
i-robot 2022-07-12 03:31:07 +00:00 committed by Gitee
commit 2c1e9e4544
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,29 @@
mindspore.ops.SquareSumAll
==========================
.. py:class:: mindspore.ops.SquareSumAll
计算输入Tensor的平方和。
.. math::
\left\{\begin{matrix}out_{x} = {\textstyle \sum_{0}^{N}} (x_{i})^2
\\out_{y} = {\textstyle \sum_{0}^{N}} (y_{i})^2
\end{matrix}\right.
.. note::
SquareSumAll只支持float32和float64类型的输入值。
**输入:**
- **x** (Tensor) - SquareSumAll的输入其数据类型为数值型shape :math:`(N, *)` ,其中 :math:`*` 表示任意数量的附加维度。
- **y** (Tensor) - 数据类型和shape与 `x` 相同。
**输出:**
- **output_x** (Tensor) - 数据类型与 `x` 相同。
- **output_y** (Tensor) - 数据类型与 `x` 相同。
**异常:**
- **TypeError** - 如果 `x``y` 不是Tensor。
- **ValueError** - 如果 `x``y` 的shape不一致。

View File

@ -4630,6 +4630,10 @@ class SquareSumAll(Primitive):
``Ascend`` ``GPU`` ``CPU``
Examples:
>>> import numpy as np
>>> import mindspore
>>> import mindspore.ops as ops
>>> from mindspore import Tensor
>>> x = Tensor(np.array([0, 0, 2, 0]), mindspore.float32)
>>> y = Tensor(np.array([0, 0, 2, 4]), mindspore.float32)
>>> square_sum_all = ops.SquareSumAll()