Browse Source

!10419 update example of Cast, Concat and Argmax operator

From: @wuxuejian
Reviewed-by: @liangchenghui,@oacjiewen
Signed-off-by: @liangchenghui
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
3c20f996c4
1 changed files with 10 additions and 10 deletions
  1. +10
    -10
      mindspore/ops/operations/array_ops.py

+ 10
- 10
mindspore/ops/operations/array_ops.py View File

@@ -289,11 +289,11 @@ class Cast(PrimitiveWithInfer):
Examples:
>>> input_np = np.random.randn(2, 3, 4, 5).astype(np.float32)
>>> input_x = Tensor(input_np)
>>> type_dst = mindspore.float16
>>> type_dst = mindspore.int32
>>> cast = ops.Cast()
>>> output = cast(input_x, type_dst)
>>> print(output.dtype)
Float16
Int32
>>> print(output.shape)
(2, 3, 4, 5)
"""
@@ -1541,10 +1541,10 @@ class Argmax(PrimitiveWithInfer):
``Ascend`` ``GPU`` ``CPU``

Examples:
>>> input_x = Tensor(np.array([2.0, 3.1, 1.2]), mindspore.float32)
>>> input_x = Tensor(np.array([[1, 20, 5], [67, 8, 9], [130, 24, 15]]).astype(np.float32))
>>> output = ops.Argmax(output_type=mindspore.int32)(input_x)
>>> print(output)
1
[1 0 0]
"""

@prim_attr_register
@@ -2115,15 +2115,15 @@ class Concat(PrimitiveWithInfer):
``Ascend`` ``GPU`` ``CPU``

Examples:
>>> data1 = Tensor(np.array([[0, 1], [2, 1]]).astype(np.int32))
>>> data2 = Tensor(np.array([[0, 1], [2, 1]]).astype(np.int32))
>>> data1 = Tensor(np.array([[0, 1], [2, 1]]).astype(np.float32))
>>> data2 = Tensor(np.array([[0, 1], [2, 1]]).astype(np.float32))
>>> op = ops.Concat()
>>> output = op((data1, data2))
>>> print(output)
[[0 1]
[2 1]
[0 1]
[2 1]]
[[0. 1.]
[2. 1.]
[0. 1.]
[2. 1.]]
"""

@prim_attr_register


Loading…
Cancel
Save