Merge pull request !20200 from lianliguang/code_docs_primitive
This commit is contained in:
i-robot 2021-07-13 12:51:19 +00:00 committed by Gitee
commit d0dae7bb94
2 changed files with 40 additions and 39 deletions

View File

@ -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", "")

View File

@ -100,7 +100,7 @@ class Primitive(Primitive_):
name (str): Attribute Name.
value (Any): Attribute value.
Example:
Examples:
>>> import mindspore.ops as P
>>> a = P.Add()
>>> a = a.add_prim_attr("attr",1)
@ -119,7 +119,7 @@ class Primitive(Primitive_):
Args:
name (str): Attribute Name.
Example:
Examples:
>>> import mindspore.ops as P
>>> a = P.Add()
>>> a = a.add_prim_attr("attr",1)
@ -142,7 +142,7 @@ class Primitive(Primitive_):
In other parallel modes, please set it to be 0.
Args:
stage (int): The stage id for the current operation.
Example:
Examples:
>>> from mindspore.ops import operations as P
>>> add = P.Add()
>>> print(add.set_stage(0))
@ -161,7 +161,7 @@ class Primitive(Primitive_):
Args:
strategy (tuple): Strategy describes the distributed parallel mode of the current primitive.
Example:
Examples:
>>> from mindspore.ops import operations as P
>>> add = P.Add()
>>> print(add.shard(((1, 1), (1, 1))))
@ -189,7 +189,7 @@ class Primitive(Primitive_):
Args:
instance_name (str): Instance name of primitive operator set by user.
Example:
Examples:
>>> import mindspore.ops as P
>>> a = P.Add()
>>> a.set_prim_instance_name("add")
@ -269,7 +269,7 @@ class Primitive(Primitive_):
Args:
inputs (list[str]): list of inputs names.
outputs (list[str]): list of outputs names.
Example:
Examples:
>>> import mindspore.ops as P
>>> a = P.Add()
>>> a.init_prim_io_names(["x","y"],["sum"])
@ -301,7 +301,7 @@ class Primitive(Primitive_):
Args:
mode (bool): Specifies whether the primitive is recomputed. Default: True.
Example:
Examples:
>>> import mindspore.ops as P
>>> a = P.Add()
>>> a = a.recompute()