!10463 SequenceMask doc fix and input check

From: @peilin-wang
Reviewed-by: @liangchenghui,@wuxuejian
Signed-off-by: @liangchenghui
pull/10463/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit 45da2d7aba

@ -886,6 +886,10 @@ AbstractBasePtr InferImplSequenceMask(const AnalysisEnginePtr &, const Primitive
maxlen_value = *static_cast<int64_t *>(maxlen_tensor->data_c());
}
if (maxlen_value <= 0) {
MS_LOG(EXCEPTION) << "maxlen must be positive, but got: " << maxlen_value;
}
ShapeVector lengths_shape = lengths->shape()->shape();
ShapeVector lengths_shape_min = lengths->shape()->min_shape();
if (lengths_shape_min.empty()) {

@ -114,7 +114,7 @@ def sequence_mask(lengths, maxlen):
Args:
length (Tensor): Tensor to calculate the mask for. All values in this tensor must be
less than `maxlen`. Must be type int32 or int64.
less than or equal to `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`.

Loading…
Cancel
Save