diff --git a/mindspore/ops/op_info_register.py b/mindspore/ops/op_info_register.py index e64b1352f9b..9841257acb1 100644 --- a/mindspore/ops/op_info_register.py +++ b/mindspore/ops/op_info_register.py @@ -568,7 +568,7 @@ class TBERegOp(RegOp): class DataType: - """ + r""" Ascend ops various combinations of dtype and format. The current list below may be incomplete. @@ -577,6 +577,7 @@ class DataType: current support: .. code-block:: + None_None = ("", "") None_Default = ("", "DefaultFormat") BOOL_None = ("bool", "") diff --git a/mindspore/ops/primitive.py b/mindspore/ops/primitive.py index 7e3df2639bc..39cdad580c0 100644 --- a/mindspore/ops/primitive.py +++ b/mindspore/ops/primitive.py @@ -100,12 +100,12 @@ class Primitive(Primitive_): name (str): Attribute Name. value (Any): Attribute value. - Example: - >>>import mindspore.ops as P - >>>a = P.Add() - >>>a = a.add_prim_attr("attr",1) - >>>out = a.attrs["attr"] - >>>print(out) + Examples: + >>> import mindspore.ops as P + >>> a = P.Add() + >>> a = a.add_prim_attr("attr",1) + >>> out = a.attrs["attr"] + >>> print(out) 1 """ self.__dict__[name] = value @@ -119,12 +119,12 @@ class Primitive(Primitive_): Args: name (str): Attribute Name. - Example: - >>>import mindspore.ops as P - >>>a = P.Add() - >>>a = a.add_prim_attr("attr",1) - >>>a = a.del_prim_attr("attr") - >>>a.attrs + Examples: + >>> import mindspore.ops as P + >>> a = P.Add() + >>> a = a.add_prim_attr("attr",1) + >>> a = a.del_prim_attr("attr") + >>> a.attrs {'input_names': ['x', 'y'], 'output_names' : ['output']} """ if name in self.__dict__ and name in self.attrs: @@ -142,11 +142,11 @@ class Primitive(Primitive_): 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] + Examples: + >>> 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 @@ -161,11 +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] + Examples: + >>> 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: @@ -189,11 +189,11 @@ class Primitive(Primitive_): Args: instance_name (str): Instance name of primitive operator set by user. - Example: - >>>import mindspore.ops as P - >>>a = P.Add() - >>>a.set_prim_instance_name("add") - >>>a.instance_name + Examples: + >>> import mindspore.ops as P + >>> a = P.Add() + >>> a.set_prim_instance_name("add") + >>> a.instance_name 'add' """ self.set_instance_name(instance_name) @@ -269,13 +269,13 @@ class Primitive(Primitive_): Args: inputs (list[str]): list of inputs names. outputs (list[str]): list of outputs names. - Example: - >>>import mindspore.ops as P - >>>a = P.Add() - >>>a.init_prim_io_names(["x","y"],["sum"]) - >>>a.input_names + Examples: + >>> import mindspore.ops as P + >>> a = P.Add() + >>> a.init_prim_io_names(["x","y"],["sum"]) + >>> a.input_names ['x','y'] - >>>a.output_names + >>> a.output_names ['sum'] """ # for checking para names with kernel implementation @@ -301,11 +301,11 @@ class Primitive(Primitive_): Args: mode (bool): Specifies whether the primitive is recomputed. Default: True. - Example: - >>>import mindspore.ops as P - >>>a = P.Add() - >>>a = a.recompute() - >>>a.recompute + Examples: + >>> import mindspore.ops as P + >>> a = P.Add() + >>> a = a.recompute() + >>> a.recompute True """ if context.get_context("mode") == context.PYNATIVE_MODE: