From 789123c5cd21973a2c4908dc5ecb3864b82cd742 Mon Sep 17 00:00:00 2001 From: wangshuide2020 <7511764+wangshuide2020@user.noreply.gitee.com> Date: Wed, 23 Dec 2020 14:32:50 +0800 Subject: [PATCH] update the description of EmbeddingLookup operator and add the output of multinomial operator. --- mindspore/nn/layer/embedding.py | 3 ++- mindspore/ops/composite/random_ops.py | 2 +- mindspore/ops/operations/array_ops.py | 3 ++- mindspore/ops/operations/random_ops.py | 2 ++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mindspore/nn/layer/embedding.py b/mindspore/nn/layer/embedding.py index 90945c1574..e8361e6b19 100755 --- a/mindspore/nn/layer/embedding.py +++ b/mindspore/nn/layer/embedding.py @@ -173,7 +173,8 @@ class EmbeddingLookup(Cell): Inputs: - **input_indices** (Tensor) - The shape of tensor is :math:`(y_1, y_2, ..., y_S)`. Specifies the indices of elements of the original Tensor. Values can be out of range of embedding_table, - and the exceeding part will be filled with 0 in the output. Input_indices must only be a 2d tensor in + and the exceeding part will be filled with 0 in the output. Values does not support negative and the result + is undefined if values are negative. Input_indices must only be a 2d tensor in this interface when run in semi auto parallel/auto parallel mode. Outputs: diff --git a/mindspore/ops/composite/random_ops.py b/mindspore/ops/composite/random_ops.py index 2d0ec2b0b4..bf09e829d1 100644 --- a/mindspore/ops/composite/random_ops.py +++ b/mindspore/ops/composite/random_ops.py @@ -258,7 +258,7 @@ def multinomial(inputs, num_sample, replacement=True, seed=None): >>> input = Tensor([0, 9, 4, 0], mstype.float32) >>> output = C.multinomial(input, 2, True) >>> print(output) - [1 2] + [1 1] """ shape = P.Shape() reshape = P.Reshape() diff --git a/mindspore/ops/operations/array_ops.py b/mindspore/ops/operations/array_ops.py index f741a11ecf..ee189c6585 100644 --- a/mindspore/ops/operations/array_ops.py +++ b/mindspore/ops/operations/array_ops.py @@ -4580,7 +4580,8 @@ class EmbeddingLookup(PrimitiveWithInfer): This represents a Tensor slice, instead of the entire Tensor. Currently, the dimension is restricted to be 2. - **input_indices** (Tensor) - The shape of tensor is :math:`(y_1, y_2, ..., y_S)`. Specifies the indices of elements of the original Tensor. Values can be out of range of `input_params`, - and the exceeding part will be filled with 0 in the output. + and the exceeding part will be filled with 0 in the output. Values does not support negative and the result + is undefined if values are negative. - **offset** (int) - Specifies the offset value of this `input_params` slice. Thus the real indices are equal to `input_indices` minus `offset`. diff --git a/mindspore/ops/operations/random_ops.py b/mindspore/ops/operations/random_ops.py index 8fbcd355bd..e7cf55d601 100644 --- a/mindspore/ops/operations/random_ops.py +++ b/mindspore/ops/operations/random_ops.py @@ -498,6 +498,8 @@ class Multinomial(PrimitiveWithInfer): >>> input = Tensor([0., 9., 4., 0.], mstype.float32) >>> multinomial = ops.Multinomial(seed=10) >>> output = multinomial(input, 2) + >>> print(output) + [2 1] """ @prim_attr_register