diff options
Diffstat (limited to 'src/core/SubTensorInfo.cpp')
-rw-r--r-- | src/core/SubTensorInfo.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/core/SubTensorInfo.cpp b/src/core/SubTensorInfo.cpp index be8560fd61..a50f584023 100644 --- a/src/core/SubTensorInfo.cpp +++ b/src/core/SubTensorInfo.cpp @@ -41,12 +41,6 @@ namespace */ TensorShape extend_parent_shape(TensorShape parent_shape, TensorShape shape, Coordinates coords) { - // Subtensor should not index in x, y dimensions. - ARM_COMPUTE_ERROR_ON((coords.x() != 0) || (coords.y() != 0)); - - // Cannot extend on x, y ? - ARM_COMPUTE_ERROR_ON((parent_shape.total_size() != 0) && (parent_shape.x() != shape.x()) && (parent_shape.y() != shape.y())); - // Extend shape for(unsigned int i = 0; i < TensorShape::num_max_dimensions; ++i) { @@ -70,6 +64,7 @@ SubTensorInfo::SubTensorInfo(ITensorInfo *parent, TensorShape tensor_shape, Coor : _parent(parent), _tensor_shape(tensor_shape), _coords(coords), _valid_region{ Coordinates(), _tensor_shape }, _extend_parent(extend_parent) { ARM_COMPUTE_ERROR_ON(parent == nullptr); + // Check if subtensor is valid if parent is configured if(parent->tensor_shape().total_size() != 0 && !_extend_parent) { @@ -118,6 +113,17 @@ bool SubTensorInfo::extend_padding(const PaddingSize &padding) ARM_COMPUTE_ERROR_ON(!_parent->is_resizable()); ARM_COMPUTE_ERROR_ON(_parent->total_size() == 0); + // Check that you do not extend padding on sub-tensors unless XY shape matches parent tensor + // TODO(COMPMID-3558): Remove _extend_parent check + if(!_extend_parent && (padding.left || padding.right)) + { + ARM_COMPUTE_ERROR_ON(_parent->tensor_shape().x() != tensor_shape().x()); + } + if(!_extend_parent && (padding.top || padding.bottom)) + { + ARM_COMPUTE_ERROR_ON(_parent->tensor_shape().y() != tensor_shape().y()); + } + // Extend parent padding if required return _parent->extend_padding(padding); } |