42 TensorShape extend_parent_shape(TensorShape parent_shape, TensorShape
shape, Coordinates coords)
47 int dimension_extend = coords[i] +
static_cast<int>(shape[i]);
48 if((dimension_extend > static_cast<int>(parent_shape[i])) && (dimension_extend > 0))
50 parent_shape.set(i, static_cast<size_t>(dimension_extend));
59 : _parent(nullptr), _tensor_shape(), _dims_state(), _coords(), _valid_region{
Coordinates(), _tensor_shape }, _extend_parent(
false)
64 : _parent(parent), _tensor_shape(tensor_shape), _dims_state(), _coords(coords), _valid_region{
Coordinates(), _tensor_shape }, _extend_parent(extend_parent)
69 if(parent->tensor_shape().total_size() != 0 && !_extend_parent)
83 auto clone_obj = _parent->
clone();
84 clone_obj->set_tensor_shape(_tensor_shape);
85 clone_obj->set_valid_region(_valid_region);
99 else if(_extend_parent)
106 _tensor_shape =
shape;
124 if(!_extend_parent && (padding.
left || padding.
right))
128 if(!_extend_parent && (padding.
top || padding.
bottom))
146 offset += pos[i] * strides[i];
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
unsigned int top
top of the border
Coordinates coords() const
Returns the coordinates of the sub-tensor inside the parent tensor.
bool extend_padding(const PaddingSize &padding) override
Update the offset to the first element, the strides and the total size.
Container for 2D border size.
virtual ITensorInfo & set_tensor_shape(const TensorShape &shape)=0
Set the shape of an already initialized tensor.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Store the tensor's metadata.
std::vector< int > TensorDimsState
unsigned int bottom
bottom of the border
const Strides & strides_in_bytes() const override
The strides in bytes for accessing each dimension of the tensor.
Copyright (c) 2017-2021 Arm Limited.
virtual void set_valid_region(const ValidRegion &valid_region)=0
Set the valid region of the tensor.
T x() const
Alias to access the size of the first dimension.
virtual bool is_resizable() const =0
Flag indicating whether the size of the tensor can be changed.
size_t offset_first_element_in_bytes() const override
The offset from the beginning of the memory allocation to the first element of the tensor...
virtual Format format() const =0
Colour format of the image.
PaddingSize padding() const override
Padding of tensor.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
size_t total_size() const
Collapses all dimensions to a single linear total size.
const TensorShape & tensor_shape() const override
Size for each dimension of the tensor.
virtual std::unique_ptr< T > clone() const =0
Provide a clone of the current object of class T.
ITensorInfo & set_tensor_dims_state(const TensorDimsState &state) override
Set the state for each dimension of the tensor.
unsigned int left
left of the border
unsigned int right
right of the border
Strides of an item in bytes.
virtual size_t total_size() const =0
Returns the total size of the tensor in bytes.
SubTensorInfo()
Default constructor.
std::unique_ptr< ITensorInfo > clone() const override
Provide a clone of the current object of class T.
unsigned int num_dimensions() const
Returns the effective dimensionality of the tensor.
int32_t offset_element_in_bytes(const Coordinates &pos) const override
The offset in bytes from the beginning of the memory allocation to access the element at position (x...
#define ARM_COMPUTE_ERROR_ON_COORDINATES_DIMENSIONS_GTE(p, md)
T y() const
Alias to access the size of the second dimension.
ITensorInfo & set_tensor_shape(const TensorShape &shape) override
Set the shape of an already initialized tensor.
Container for valid region of a window.
static constexpr size_t num_max_dimensions
Number of dimensions the tensor has.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBTENSOR(p, c, s)
virtual bool extend_padding(const PaddingSize &padding)=0
Update the offset to the first element, the strides and the total size.