mindspore2022/docs/api/api_python/ops/mindspore.ops.L2Loss.rst

25 lines
617 B
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.ops.L2Loss
====================
.. py:class:: mindspore.ops.L2Loss()
用于计算L2范数的一半但不对结果进行开方操作。
把输入设为x输出设为loss。
.. math::
loss = \frac{\sum x ^ 2}{2}
**输入:**
- **input_x** (Tensor) - 用于计算L2范数的Tensor。数据类型必须为float16或float32。
**输出:**
Tensor具有与 `input_x` 相同的数据类型的Scalar Tensor。
**异常:**
- **TypeError** - `input_x` 不是Tensor。
- **TypeError** - `input_x` 的数据类型既不是float16也不是float32。