From 21abb67e04a053388c6c1c3806e3e5b9845ef64c Mon Sep 17 00:00:00 2001 From: Zichun Ye Date: Thu, 4 Aug 2022 12:03:12 +0800 Subject: [PATCH] update validation and doc for the para paddings for spacetobatchnd --- docs/api/api_python/ops/mindspore.ops.SpaceToBatchND.rst | 2 +- mindspore/python/mindspore/ops/operations/array_ops.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/api/api_python/ops/mindspore.ops.SpaceToBatchND.rst b/docs/api/api_python/ops/mindspore.ops.SpaceToBatchND.rst index f5186324000..2a6a46cbf82 100644 --- a/docs/api/api_python/ops/mindspore.ops.SpaceToBatchND.rst +++ b/docs/api/api_python/ops/mindspore.ops.SpaceToBatchND.rst @@ -35,6 +35,6 @@ mindspore.ops.SpaceToBatchND - **TypeError** - 如果 `paddings` 不是 list 或者 tuple。 - **ValueError** - 如果当 `block_shape` 为 list 或 tuple, `block_shape` 不是一维。 - **ValueError** - 如果 Ascend 平台上 `block_shape` 长度不是2。 - - **ValueError** - 如果 `paddings` 的形状不是 (2, M), 其中 M 为 `block_shape` 的长度。 + - **ValueError** - 如果 `paddings` 的形状不是 (M, 2), 其中 M 为 `block_shape` 的长度。 - **ValueError** - 如果 `block_shape` 的元素不是大于一的整数。 - **ValueError** - 如果 `paddings` 的元素不是非负的整数。 diff --git a/mindspore/python/mindspore/ops/operations/array_ops.py b/mindspore/python/mindspore/ops/operations/array_ops.py index 58fe9e55e3c..ab9358d4a7c 100755 --- a/mindspore/python/mindspore/ops/operations/array_ops.py +++ b/mindspore/python/mindspore/ops/operations/array_ops.py @@ -5547,7 +5547,7 @@ class SpaceToBatchND(PrimitiveWithInfer): TypeError: If `paddings` is neither list nor tuple. ValueError: If `block_shape` is not one dimensional when `block_shape` is a list or tuple. ValueError: If the length of `block_shape` is not 2 on Ascend. - ValueError: If shape of `paddings` is not (2, M), where M is the length of `block_shape`. + ValueError: If shape of `paddings` is not (M, 2), where M is the length of `block_shape`. ValueError: If the element of `block_shape` is not an integer larger than 1. ValueError: If the element of `paddings` is not an integer larger than 0. @@ -5571,7 +5571,6 @@ class SpaceToBatchND(PrimitiveWithInfer): def __init__(self, block_shape, paddings): """Initialize SpaceToBatchND""" validator.check_value_type('paddings type', paddings, [list, tuple], self.name) - validator.check('paddings length', len(paddings), 'default value', 2, Rel.EQ, self.name) if isinstance(block_shape, int): block_shape = (block_shape,) * np.array(paddings).shape[0]