diff --git a/mindspore/nn/wrap/grad_reducer.py b/mindspore/nn/wrap/grad_reducer.py index 29836aec927..d7680f2c44e 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 b73dca4546c..42f0f24c6af 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: