-
Notifications
You must be signed in to change notification settings - Fork 714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc(): add IPU dy2static related docs. #4932
Changes from 1 commit
367fbb8
d71dcc7
394ae15
06c02ac
07be2aa
e383a16
a21ff85
93e6ac3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
.. _cn_api_fluid_layers_identity_loss: | ||
|
||
identity_loss | ||
------------------------------- | ||
|
||
.. py:function:: paddle.fluid.layers.identity_loss(loss, reduction='none') | ||
|
||
|
||
该OP用于在IPU动态图转静态图功能中标记网络的损失值,从而能够在IPU上为网络添加反向计算过程。该OP以网络的损失值作为输入,并对输入做reduction: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 已更改 |
||
|
||
当 `reduction` 为 `none` 时,直接返回最原始的 `Out` 结果。 | ||
|
||
当 `reduction` 为 `mean` 时,最终的输出结果为: | ||
|
||
.. math:: | ||
Out = MEAN(Out) | ||
|
||
当 `reduction` 为 `sum` 时,最终的输出结果为: | ||
|
||
.. math:: | ||
Out = SUM(Out) | ||
|
||
参数 | ||
:::::::::::: | ||
|
||
- **reduction** (str,可选) - 指定应用于输出结果的计算方式,可选值有: ``'none'``, ``'mean'``, ``'sum'`` 。默认为 ``'none'``,直接返回输入loss的值;设置为 ``'sum'`` 时,计算输入loss的总和;设置为 ``'mean'`` 时,返回输入loss的均值。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 少了 x There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 已添加 |
||
|
||
返回 | ||
:::::::::::: | ||
根据 `reduction` 返回网络损失值的计算结果。 | ||
|
||
返回类型 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 返回类型和 返回写在一起 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 已更改 |
||
:::::::::::: | ||
Variable | ||
|
||
代码示例 | ||
:::::::::::: | ||
|
||
.. code-block:: python | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 用 COPY FROM There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 已更改 |
||
|
||
import paddle.fluid as fluid | ||
import paddle | ||
paddle.enable_static() | ||
loss = fluid.data(name="loss", shape=[-1, 1], dtype="float32") | ||
out = fluid.layers.identity_loss(loss, reduction='sum') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loss -> x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已更改