diff --git a/mindspore/common/api.py b/mindspore/common/api.py index 9928450f55..e84bdab726 100644 --- a/mindspore/common/api.py +++ b/mindspore/common/api.py @@ -235,18 +235,18 @@ def ms_function(fn=None, obj=None, input_signature=None): >>> from mindspore.ops import functional as F ... >>> def tensor_add(x, y): - ... z = F.tensor_add(x, y) + ... z = x + y ... return z ... >>> @ms_function ... def tensor_add_with_dec(x, y): - ... z = F.tensor_add(x, y) + ... z = x + y ... return z ... >>> @ms_function(input_signature=(MetaTensor(mindspore.float32, (1, 1, 3, 3)), ... MetaTensor(mindspore.float32, (1, 1, 3, 3)))) ... def tensor_add_with_sig(x, y): - ... z = F.tensor_add(x, y) + ... z = x + y ... return z ... >>> x = Tensor(np.ones([1, 1, 3, 3]).astype(np.float32)) diff --git a/mindspore/common/seed.py b/mindspore/common/seed.py index f2dd9c263a..a6536701c1 100644 --- a/mindspore/common/seed.py +++ b/mindspore/common/seed.py @@ -78,7 +78,7 @@ def set_seed(seed): >>> w1 = Parameter(initializer("uniform", [2, 2], ms.float32), name="w1") # W3 >>> w1 = Parameter(initializer("uniform", [2, 2], ms.float32), name="w1") # W4 >>> - >>> 2. If global seed is set, numpy.random and initializer will use it: + >>> # 2. If global seed is set, numpy.random and initializer will use it: >>> set_seed(1234) >>> np_1 = np.random.normal(0, 1, [1]).astype(np.float32) # A1 >>> np_1 = np.random.normal(0, 1, [1]).astype(np.float32) # A2 @@ -95,7 +95,7 @@ def set_seed(seed): >>> # mindspore.nn.probability.distribution will choose a random seed: >>> c1 = C.uniform((1, 4), minval, maxval) # C1 >>> c2 = C.uniform((1, 4), minval, maxval) # C2 - >>> Rerun the program will get different results: + >>> # Rerun the program will get different results: >>> c1 = C.uniform((1, 4), minval, maxval) # C3 >>> c2 = C.uniform((1, 4), minval, maxval) # C4 >>> @@ -118,7 +118,7 @@ def set_seed(seed): >>> set_seed(1234) >>> c1 = C.uniform((1, 4), minval, maxval, seed=2) # C1 >>> c2 = C.uniform((1, 4), minval, maxval, seed=2) # C2 - >>> Rerun the program will get the same results: + >>> # Rerun the program will get the same results: >>> set_seed(1234) >>> c1 = C.uniform((1, 4), minval, maxval, seed=2) # C1 >>> c2 = C.uniform((1, 4), minval, maxval, seed=2) # C2 @@ -235,7 +235,8 @@ def _get_graph_seed(op_seed, kernel_name): Interger. The current graph-level seed. Examples: - >>> _get_graph_seed(seed, 'normal') + >>> print(_get_graph_seed(0, 'normal')) + (0, 0) """ global_seed = get_seed() if global_seed == 0: diff --git a/mindspore/common/tensor.py b/mindspore/common/tensor.py index 13e871350f..ad4167a272 100644 --- a/mindspore/common/tensor.py +++ b/mindspore/common/tensor.py @@ -301,7 +301,7 @@ class Tensor(Tensor_): Reshape the tensor according to the input shape. Args: - shape (Union(list[int], \*int)): Dimension of the output tensor. + shape (Union(tuple[int], \*int)): Dimension of the output tensor. Returns: Tensor, has the same dimension as the input shape.