Modify api documentation based on view comments

This commit is contained in:
mahequn123 2022-03-28 10:16:40 +08:00
parent d4b4fa3d2d
commit c910b72366
3 changed files with 22 additions and 29 deletions

View File

@ -1,26 +1,20 @@
mindspore.profiler
========================
profiler模块简介。
本模块提供Python API用于启用MindSpore神经网络性能数据的分析。
用户可以通过 ``import mindspore.profiler.Profiler`` 并初始化Profiler对象以开始分析使用 `Profiler.analyse()` 停止收集和分析。
用户可以通过导入 `mindspore.profiler.Profiler` 然后初始化Profiler对象以开始分析使用 `Profiler.analyse()` 停止收集和分析。
用户可通过Mindinsight工具可视化分析结果。
目前Profiler支持AICore算子、AICpu算子、HostCpu算子、内存、设备通信、集群等数据的分析。
目前Profiler支持AICORE算子、AICPU算子、HostCPU算子、内存、设备通信、集群等数据的分析。
.. py:class:: mindspore.profiler.Profiler(**kwargs)
性能采集API。
此API能够让MindSpore用户采集神经网络的性能。
Profiler支持Ascend和GPU两者的使用方式相同。
MindSpore用户能够通过该类对神经网络的性能进行采集。
**参数:**
- **output_path** (str) 表示输出数据的路径。
- **profile_communication** (bool) 仅限Ascend表示是否在多设备训练中收集通信性能数据。当值为True时收集这些数据。默认值为False。在单台设备训练中该参数的设置无效。
- **profile_memory** (bool) 仅限Ascend表示是否收集Tensor内存数据。当值为True时收集这些数据。默认值为False。
- **start_profile** (bool) 该参数控制是否在Profiler初始化的时候开启采集数据。默认值为True。
- **output_path** (str, 可选) 表示输出数据的路径。默认值:"./data"。
- **profile_communication** (bool, 可选) 仅限Ascend表示是否在多设备训练中收集通信性能数据。当值为True时收集这些数据。在单台设备训练中该参数的设置无效。默认值False。
- **profile_memory** (bool, 可选) 仅限Ascend表示是否收集Tensor内存数据。当值为True时收集这些数据。默认值False。
- **start_profile** (bool, 可选) 该参数控制是否在Profiler初始化的时候开启数据采集。默认值True。
**异常:**
@ -28,7 +22,7 @@ profiler模块简介。
.. py:method:: analyse()
收集和分析训练后或训练期间调用的性能数据。样例如上所示。
收集和分析训练的性能数据,支持在训练中和训练后调用。样例如上所示。
.. py:method:: start()

View File

@ -13,13 +13,11 @@
# limitations under the License.
# ============================================================================
"""
Profiler Module Introduction.
This module provides Python APIs to enable the profiling of MindSpore neural networks.
Users can import the mindspore.profiler.Profiler, initialize the Profiler object to start profiling,
and use Profiler.analyse() to stop profiling and analyse the results.
Users can visualize the results using the MindInsight tool.
Now, Profiler supports AICore operator, AICpu operator, HostCpu operator, memory,
Now, Profiler supports AICORE operator, AICPU operator, HostCPU operator, memory,
correspondence, cluster, etc data analysis.
"""
from mindspore.profiler.profiling import Profiler

View File

@ -55,24 +55,25 @@ def _environment_check():
class Profiler:
"""
Performance profiling API.
This API enables MindSpore users to profile the performance of neural network.
Profiler supports Ascend and GPU, both of them are used in the same way.
MindSpore users can use this class to collect the performance of neural networks.
Args:
output_path (str): Output data path.
profile_communication (bool): (Ascend only) Whether to collect communication
performance data in a multi devices training, collect when True. Default is False.
Setting this parameter has no effect during single device training.
profile_memory (bool): Whether to collect tensor memory data, collect when True. Default is False.
start_profile (bool): The start_profile parameter controls whether to enable or disable performance data
collection based on conditions. The default value is True.
output_path (str, optional): Output data path. Default: "./data".
profile_communication (bool, optional): (Ascend only) Whether to collect communication performance data in
a multi devices training,collect when True. Setting this parameter has no effect during single device
training. Default: False.
profile_memory (bool, optional): (Ascend only) Whether to collect tensor memory data, collect when True.
Default: False.
start_profile (bool, optional): The start_profile parameter controls whether to enable or disable performance
data collection based on conditions. Default: True.
Raises:
RuntimeError: When the version of CANN does not match the version of MindSpore,
MindSpore cannot parse the generated ascend_job_id directory structure.
Supported Platforms:
``Ascend`` ``GPU``
Examples:
>>> import numpy as np
>>> from mindspore import nn, context
@ -295,7 +296,7 @@ class Profiler:
def analyse(self):
"""
Collect and analyse performance data, called after training or during training. The example shows above.
Collect and analyze training performance data, support calls during and after training. The example shows above.
"""
if Profiler._has_analysed:
msg = "Do not analyze twice in the profiler."