From: @zhangz0911gm Reviewed-by: @liangchenghui Signed-off-by:tags/v1.1.0
| @@ -128,13 +128,13 @@ def uniform(shape, minval, maxval, seed=None, dtype=mstype.float32): | |||||
| The dtype is designated as the input `dtype`. | The dtype is designated as the input `dtype`. | ||||
| Examples: | Examples: | ||||
| >>> For discrete uniform distribution, only one number is allowed for both minval and maxval: | |||||
| >>> # For discrete uniform distribution, only one number is allowed for both minval and maxval: | |||||
| >>> shape = (4, 2) | >>> shape = (4, 2) | ||||
| >>> minval = Tensor(1, mstype.int32) | >>> minval = Tensor(1, mstype.int32) | ||||
| >>> maxval = Tensor(2, mstype.int32) | >>> maxval = Tensor(2, mstype.int32) | ||||
| >>> output = C.uniform(shape, minval, maxval, seed=5, dtype=mstype.int32) | >>> output = C.uniform(shape, minval, maxval, seed=5, dtype=mstype.int32) | ||||
| >>> | >>> | ||||
| >>> For continuous uniform distribution, minval and maxval can be multi-dimentional: | |||||
| >>> # For continuous uniform distribution, minval and maxval can be multi-dimentional: | |||||
| >>> shape = (4, 2) | >>> shape = (4, 2) | ||||
| >>> minval = Tensor([1.0, 2.0], mstype.float32) | >>> minval = Tensor([1.0, 2.0], mstype.float32) | ||||
| >>> maxval = Tensor([4.0, 5.0], mstype.float32) | >>> maxval = Tensor([4.0, 5.0], mstype.float32) | ||||
| @@ -1151,8 +1151,8 @@ class Ones(PrimitiveWithInfer): | |||||
| >>> ones = ops.Ones() | >>> ones = ops.Ones() | ||||
| >>> output = ones((2, 2), mindspore.float32) | >>> output = ones((2, 2), mindspore.float32) | ||||
| >>> print(output) | >>> print(output) | ||||
| [[1.0, 1.0], | |||||
| [1.0, 1.0]] | |||||
| [[1. 1.] | |||||
| [1. 1.]] | |||||
| """ | """ | ||||
| @prim_attr_register | @prim_attr_register | ||||
| @@ -1204,8 +1204,8 @@ class Zeros(PrimitiveWithInfer): | |||||
| >>> zeros = ops.Zeros() | >>> zeros = ops.Zeros() | ||||
| >>> output = zeros((2, 2), mindspore.float32) | >>> output = zeros((2, 2), mindspore.float32) | ||||
| >>> print(output) | >>> print(output) | ||||
| [[0.0, 0.0], | |||||
| [0.0, 0.0]] | |||||
| [[0. 0.] | |||||
| [0. 0.]] | |||||
| """ | """ | ||||
| @@ -3348,7 +3348,8 @@ class ScatterSub(_ScatterOp): | |||||
| >>> scatter_sub = ops.ScatterSub() | >>> scatter_sub = ops.ScatterSub() | ||||
| >>> output = scatter_sub(input_x, indices, updates) | >>> output = scatter_sub(input_x, indices, updates) | ||||
| >>> print(output) | >>> print(output) | ||||
| [[-1.0, -1.0, -1.0], [-1.0, -1.0, -1.0]] | |||||
| [[-1. -1. -1.] | |||||
| [-1. -1. -1.]] | |||||
| """ | """ | ||||
| @@ -1376,8 +1376,8 @@ class Rsqrt(PrimitiveWithInfer): | |||||
| >>> rsqrt = ops.Rsqrt() | >>> rsqrt = ops.Rsqrt() | ||||
| >>> output = rsqrt(input_tensor) | >>> output = rsqrt(input_tensor) | ||||
| >>> print(output) | >>> print(output) | ||||
| [[0.5 0.5 ] | |||||
| [0.333334 0.333334]] | |||||
| [[0.5 0.5 ] | |||||
| [0.33333334 0.33333334]] | |||||
| """ | """ | ||||
| @prim_attr_register | @prim_attr_register | ||||
| @@ -1677,7 +1677,7 @@ class Log(PrimitiveWithInfer): | |||||
| >>> log = ops.Log() | >>> log = ops.Log() | ||||
| >>> output = log(input_x) | >>> output = log(input_x) | ||||
| >>> print(output) | >>> print(output) | ||||
| [0. 0.6931472 1.38629444] | |||||
| [0. 0.6931472 1.3862944] | |||||
| """ | """ | ||||
| @prim_attr_register | @prim_attr_register | ||||