From 1fd90d1f37382e408008838a401798708979fb0b Mon Sep 17 00:00:00 2001 From: huangxinjing Date: Thu, 8 Jul 2021 17:09:08 +0800 Subject: [PATCH] Fix document --- mindspore/nn/wrap/grad_reducer.py | 2 +- mindspore/ops/primitive.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mindspore/nn/wrap/grad_reducer.py b/mindspore/nn/wrap/grad_reducer.py index 29836aec92..d7680f2c44 100644 --- a/mindspore/nn/wrap/grad_reducer.py +++ b/mindspore/nn/wrap/grad_reducer.py @@ -291,7 +291,7 @@ class DistributedGradReducer(Cell): ValueError: If degree is not a int or less than 0. Supported Platforms: - ``Ascend``, ``GPU`` + ``Ascend`` ``GPU`` Examples: >>> # This example should be run with multiple processes. diff --git a/mindspore/ops/primitive.py b/mindspore/ops/primitive.py index b73dca4546..42f0f24c6a 100644 --- a/mindspore/ops/primitive.py +++ b/mindspore/ops/primitive.py @@ -140,9 +140,13 @@ class Primitive(Primitive_): Note: It is valid only in semi auto parallel. In other parallel modes, please set it to be 0. - Args: stage (int): The stage id for the current operation. + Example: + >>> from mindspore.ops import operations as P + >>> add = P.Add() + >>> print(add.set_stage(0)) + Prim[Add] """ self.add_prim_attr("stage", stage) return self @@ -157,6 +161,11 @@ class Primitive(Primitive_): Args: strategy (tuple): Strategy describes the distributed parallel mode of the current primitive. + Example: + >>> from mindspore.ops import operations as P + >>> add = P.Add() + >>> print(add.shard(((1, 1), (1, 1)))) + Prim[Add] """ mode = context.get_auto_parallel_context("parallel_mode") if strategy is not None: