forked from mindspore-Ecosystem/mindspore
!20138 update the result of example of Split, AdaptiveAvgPool2D and ReduceMean operators.
Merge pull request !20138 from wangshuide/code_docs_wsd_master_new
This commit is contained in:
commit
d24c508bf0
|
@ -723,10 +723,10 @@ class SequenceMask(PrimitiveWithCheck):
|
||||||
>>> sequence_mask = ops.SequenceMask()
|
>>> sequence_mask = ops.SequenceMask()
|
||||||
>>> output = sequence_mask(x, 3)
|
>>> output = sequence_mask(x, 3)
|
||||||
>>> print(output)
|
>>> print(output)
|
||||||
[[[True, False, False],
|
[[[True False False]
|
||||||
[True, True, True]],
|
[True True True]]
|
||||||
[[True, True, False],
|
[[True True False]
|
||||||
[False, False, False]]]
|
[False False False]]]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@prim_attr_register
|
@prim_attr_register
|
||||||
|
|
|
@ -1040,10 +1040,10 @@ class Split(PrimitiveWithCheck):
|
||||||
>>> output = split(x)
|
>>> output = split(x)
|
||||||
>>> print(output)
|
>>> print(output)
|
||||||
(Tensor(shape=[2, 2], dtype=Int32, value=
|
(Tensor(shape=[2, 2], dtype=Int32, value=
|
||||||
[[1 1]
|
[[1, 1],
|
||||||
[2 2]]), Tensor(shape=[2, 2], dtype=Int32, value=
|
[2, 2]]), Tensor(shape=[2, 2], dtype=Int32, value=
|
||||||
[[1 1]
|
[[1, 1],
|
||||||
[2 2]]))
|
[2, 2]]))
|
||||||
>>> split = ops.Split(1, 4)
|
>>> split = ops.Split(1, 4)
|
||||||
>>> output = split(x)
|
>>> output = split(x)
|
||||||
>>> print(output)
|
>>> print(output)
|
||||||
|
|
|
@ -460,8 +460,8 @@ class ReduceMean(_Reduce):
|
||||||
[5. ]
|
[5. ]
|
||||||
[6. ]]
|
[6. ]]
|
||||||
[[7.0000005]
|
[[7.0000005]
|
||||||
[5. ]
|
[8. ]
|
||||||
[6. ]]]
|
[9. ]]]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -179,15 +179,15 @@ class AdaptiveAvgPool2D(PrimitiveWithInfer):
|
||||||
>>> adaptive_avg_pool_2d = ops.AdaptiveAvgPool2D((None, 2))
|
>>> adaptive_avg_pool_2d = ops.AdaptiveAvgPool2D((None, 2))
|
||||||
>>> output = adaptive_avg_pool_2d(input_x)
|
>>> output = adaptive_avg_pool_2d(input_x)
|
||||||
>>> print(output)
|
>>> print(output)
|
||||||
[[[2.5 3.5]
|
[[[1.5 2.5]
|
||||||
[4.5 5.5]
|
[4.5 5.5]
|
||||||
[6.5 7.5]]
|
[7.5 8.5]]
|
||||||
[[2.5 3.5]
|
[[1.5 2.5]
|
||||||
[4.5 5.5]
|
[4.5 5.5]
|
||||||
[6.5 7.5]]
|
[7.5 8.5]]
|
||||||
[[2.5 3.5]
|
[[1.5 2.5]
|
||||||
[4.5 5.5]
|
[4.5 5.5]
|
||||||
[6.5 7.5]]]
|
[7.5 8.5]]]
|
||||||
>>> # case 2: output_size=2
|
>>> # case 2: output_size=2
|
||||||
>>> adaptive_avg_pool_2d = ops.AdaptiveAvgPool2D(2)
|
>>> adaptive_avg_pool_2d = ops.AdaptiveAvgPool2D(2)
|
||||||
>>> output = adaptive_avg_pool_2d(input_x)
|
>>> output = adaptive_avg_pool_2d(input_x)
|
||||||
|
@ -202,9 +202,9 @@ class AdaptiveAvgPool2D(PrimitiveWithInfer):
|
||||||
>>> adaptive_avg_pool_2d = ops.AdaptiveAvgPool2D((1, 2))
|
>>> adaptive_avg_pool_2d = ops.AdaptiveAvgPool2D((1, 2))
|
||||||
>>> output = adaptive_avg_pool_2d(input_x)
|
>>> output = adaptive_avg_pool_2d(input_x)
|
||||||
>>> print(output)
|
>>> print(output)
|
||||||
[[[3.5 6.5]]
|
[[[4.5 5.5]]
|
||||||
[[3.5 6.5]]
|
[[4.5 5.5]]
|
||||||
[[3.5 6.5]]]
|
[[4.5 5.5]]]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@prim_attr_register
|
@prim_attr_register
|
||||||
|
@ -6723,7 +6723,7 @@ class ApplyFtrl(PrimitiveWithInfer):
|
||||||
>>> net = ApplyFtrlNet()
|
>>> net = ApplyFtrlNet()
|
||||||
>>> input_x = Tensor(np.array([[0.3, 0.7], [0.1, 0.8]]).astype(np.float32))
|
>>> input_x = Tensor(np.array([[0.3, 0.7], [0.1, 0.8]]).astype(np.float32))
|
||||||
>>> output = net(input_x)
|
>>> output = net(input_x)
|
||||||
>>> print(output)
|
>>> print(net.var.asnumpy())
|
||||||
[[ 0.0390525, 0.11492836]
|
[[ 0.0390525, 0.11492836]
|
||||||
[ 0.00066425, 0.15075898]]
|
[ 0.00066425, 0.15075898]]
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -236,7 +236,7 @@ class Primitive(Primitive_):
|
||||||
>>> input_x = Tensor(np.array([1, 2, 3]), mindspore.float32)
|
>>> input_x = Tensor(np.array([1, 2, 3]), mindspore.float32)
|
||||||
>>> output = addn.check_elim((input_x,))
|
>>> output = addn.check_elim((input_x,))
|
||||||
>>> print(output)
|
>>> print(output)
|
||||||
(True, Tensor(shape = [3], dtype = Float32, value = [1.0000000e+00,2.0000000e+00,3.0000000e+00]))
|
(True, Tensor(shape = [3], dtype = Float32, value = [1.0000000e+00,2.0000000e+00,3.0000000e+00]))
|
||||||
"""
|
"""
|
||||||
return (False, None)
|
return (False, None)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue