From a2be904e3204228f8c8d99f70c6a7489688d5df3 Mon Sep 17 00:00:00 2001 From: hedongdong Date: Mon, 28 Dec 2020 20:39:10 +0800 Subject: [PATCH] BUG-Fixed: [CT][MS][Document] correct the description of the operator sequence_mask --- mindspore/ops/composite/array_ops.py | 7 ++++--- mindspore/ops/operations/_inner_ops.py | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mindspore/ops/composite/array_ops.py b/mindspore/ops/composite/array_ops.py index f3bbb3af5e..894abc7777 100644 --- a/mindspore/ops/composite/array_ops.py +++ b/mindspore/ops/composite/array_ops.py @@ -113,11 +113,12 @@ def sequence_mask(lengths, maxlen): [d_1, d_2, ..., d_n, maxlen], with mask[i_1, i_2, ..., i_n, j] = (j < lengths[i_1, i_2, ..., i_n]) Inputs: - - **lengths** (Tensor) - Tensor to calculate the mask for. All values in this tensor must be - less than or equal to `maxlen`. Must be type int32 or int64. + - **lengths** (Tensor) - Tensor to calculate the mask for. All values in this tensor should be + less than or equal to `maxlen`. Values greater than `maxlen` will be treated as `maxlen`. + Must be type int32 or int64. - **maxlen** (int) - size of the last dimension of returned tensor. Must be positive and same - type as elements in `lengths`. Default is the maximum value in lengths. + type as elements in `lengths`. Outputs: One mask tensor of shape lengths.shape + (maxlen,). diff --git a/mindspore/ops/operations/_inner_ops.py b/mindspore/ops/operations/_inner_ops.py index 32d8f4e4cc..609717c33d 100644 --- a/mindspore/ops/operations/_inner_ops.py +++ b/mindspore/ops/operations/_inner_ops.py @@ -689,11 +689,12 @@ class SequenceMask(PrimitiveWithCheck): [d_1, d_2, ..., d_n, maxlen], with mask[i_1, i_2, ..., i_n, j] = (j < lengths[i_1, i_2, ..., i_n]) Inputs: - - **lengths** (Tensor) - Tensor to calculate the mask for. All values in this tensor must be - less than or equal to `maxlen`. Must be type int32 or int64. + - **lengths** (Tensor) - Tensor to calculate the mask for. All values in this tensor should be + less than or equal to `maxlen`. Values greater than `maxlen` will be treated as `maxlen`. + Must be type int32 or int64. - **maxlen** (int) - size of the last dimension of returned tensor. Must be positive and same - type as elements in `lengths`. Default is the maximum value in lengths. + type as elements in `lengths`. Outputs: One mask tensor of shape lengths.shape + (maxlen,).