!31087 Add web link for Cell and Primitive

Merge pull request !31087 from maning202007/code_docs_dump_api
This commit is contained in:
i-robot 2022-03-10 09:25:31 +00:00 committed by Gitee
commit c91bc888de
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 5 additions and 3 deletions

View File

@ -5,7 +5,7 @@ mindspore.set_dump
启用或者禁用target及其子节点的Dump数据功能。
target为Cell或Primitive的实例。请注意此API仅在开启异步Dump功能且Dump配置文件中的 `dump_mode` 字段为"2"时生效。有关详细信息,请参阅 `Dump功能文档 <https://mindspore.cn/docs/programming_guide/zh-CN/master/dump_in_graph_mode.html>`_ 。默认状态下Cell和Primitive实例不使能Dump数据功能。
target为 `Cell <https://www.mindspore.cn/docs/api/zh-CN/master/api_python/nn/mindspore.nn.Cell.html#mindspore.nn.Cell>`_ `Primitive <https://www.mindspore.cn/docs/api/zh-CN/master/api_python/ops/mindspore.ops.Primitive.html#mindspore.ops.Primitive>`_ 的实例。请注意此API仅在开启异步Dump功能且Dump配置文件中的 `dump_mode` 字段为"2"时生效。有关详细信息,请参阅 `Dump功能文档 <https://mindspore.cn/docs/programming_guide/zh-CN/master/dump_in_graph_mode.html>`_ 。默认状态下Cell和Primitive实例不使能Dump数据功能。
.. Warning::
此API还在实验阶段后续可能修改或删除。
@ -13,7 +13,7 @@ mindspore.set_dump
.. Note::
- 此API只在Ascend后端的图模式有效。
- 当target是一个Cell且enabled设置为True时Cell实例及其子Cell实例的Primitive将递归启用Dump。如果算子不是Cell实例的成员则不会为该算子启用Dump例如在construct方法中直接使用的 `functional 算子 <https://www.mindspore.cn/docs/api/zh-CN/master/api_python/mindspore.ops.html#functional>`_ 。要使此API生效请在Cell的__init__方法中使用self.some_op = SomeOp()的写法。
- 使用set_dump(Cell, True)后Cell正向计算中的算子会被Dump大多数反向计算梯度运算产生的计算不会被Dump。然而由于图的优化一些向计算的数据仍然会被Dump。可以忽略文件名中包含“Gradients”的反向计算数据。
- 使用set_dump(Cell, True)后Cell正向计算中的算子会被Dump大多数反向计算梯度运算产生的计算不会被Dump。然而由于图的优化一些向计算的数据仍然会被Dump。可以忽略文件名中包含“Gradients”的反向计算数据。
- 此API只支持训练开始前调用。如果在训练过程中调用这个API可能不会有效果。
- 对于 `nn.SoftMaxCrossEntropyWithLogits 层 <https://www.mindspore.cn/docs/api/zh-CN/master/api_python/nn/mindspore.nn.SoftmaxCrossEntropyWithLogits.html#mindspore.nn.SoftmaxCrossEntropyWithLogits>`_ 正向计算和反向计算使用同一组算子。因此只能看到反向计算中的Dump数据。请注意当使用sparse=True和reduce=“mean”初始化时nn.SoftmaxCrossEntropyWithLogits层也将在内部使用这些算子。

View File

@ -23,7 +23,9 @@ def set_dump(target, enabled=True):
"""
Enable or disable dump for the target and its contents.
Target should be an instance of Cell or Primitive. Please note that this API takes
Target should be an instance of `Cell <https://www.mindspore.cn/docs/api/en/master/api_python/nn/
mindspore.nn.Cell.html#mindspore.nn.Cell>`_ or `Primitive<https://www.mindspore.cn/docs/api/en/master/
api_python/ops/mindspore.ops.Primitive.html#mindspore.ops.Primitive>`_ . Please note that this API takes
effect only when Asynchronous Dump is enabled and the dump_mode field in dump config file is 2. See the
`dump document <https://mindspore.cn/docs/programming_guide/en/master/dump_in_graph_mode.html>`_
for details. The default enabled status for a cell or primitive is False.