update docs for standardization of import information

This commit is contained in:
lianliguang 2021-08-03 09:49:13 +08:00
parent 7f71a99993
commit d896c744a4
1 changed files with 12 additions and 12 deletions

View File

@ -101,8 +101,8 @@ class Primitive(Primitive_):
value (Any): Attribute value. value (Any): Attribute value.
Examples: Examples:
>>> import mindspore.ops as P >>> import mindspore.ops as ops
>>> a = P.Add() >>> a = ops.Add()
>>> a = a.add_prim_attr("attr",1) >>> a = a.add_prim_attr("attr",1)
>>> out = a.attrs["attr"] >>> out = a.attrs["attr"]
>>> print(out) >>> print(out)
@ -120,8 +120,8 @@ class Primitive(Primitive_):
Args: Args:
name (str): Attribute Name. name (str): Attribute Name.
Examples: Examples:
>>> import mindspore.ops as P >>> import mindspore.ops as ops
>>> a = P.Add() >>> a = ops.Add()
>>> a = a.add_prim_attr("attr",1) >>> a = a.add_prim_attr("attr",1)
>>> a = a.del_prim_attr("attr") >>> a = a.del_prim_attr("attr")
>>> print(a.attrs) >>> print(a.attrs)
@ -143,8 +143,8 @@ class Primitive(Primitive_):
Args: Args:
stage (int): The stage id for the current operation. stage (int): The stage id for the current operation.
Examples: Examples:
>>> from mindspore.ops import operations as P >>> from mindspore.ops as ops
>>> add = P.Add() >>> add = ops.Add()
>>> print(add.set_stage(0)) >>> print(add.set_stage(0))
Prim[Add]<stage=0> Prim[Add]<stage=0>
""" """
@ -162,8 +162,8 @@ class Primitive(Primitive_):
Args: Args:
strategy (tuple): Strategy describes the distributed parallel mode of the current primitive. strategy (tuple): Strategy describes the distributed parallel mode of the current primitive.
Examples: Examples:
>>> from mindspore.ops import operations as P >>> from mindspore.ops as ops
>>> add = P.Add() >>> add = ops.Add()
>>> print(add.shard(((1, 1), (1, 1)))) >>> print(add.shard(((1, 1), (1, 1))))
Prim[Add]<strategy=((1, 1), (1, 1))> Prim[Add]<strategy=((1, 1), (1, 1))>
""" """
@ -190,8 +190,8 @@ class Primitive(Primitive_):
Args: Args:
instance_name (str): Instance name of primitive operator set by user. instance_name (str): Instance name of primitive operator set by user.
Examples: Examples:
>>> import mindspore.ops as P >>> import mindspore.ops as ops
>>> a = P.Add() >>> a = ops.Add()
>>> a.set_prim_instance_name("add") >>> a.set_prim_instance_name("add")
>>> print(a.instance_name) >>> print(a.instance_name)
add add
@ -270,8 +270,8 @@ class Primitive(Primitive_):
inputs (list[str]): list of inputs names. inputs (list[str]): list of inputs names.
outputs (list[str]): list of outputs names. outputs (list[str]): list of outputs names.
Examples: Examples:
>>> import mindspore.ops as P >>> import mindspore.ops as ops
>>> a = P.Add() >>> a = ops.Add()
>>> a.init_prim_io_names(["x","y"],["sum"]) >>> a.init_prim_io_names(["x","y"],["sum"])
>>> print(a.input_names) >>> print(a.input_names)
['x','y'] ['x','y']