24 #ifndef ARM_COMPUTE_ITENSORINFO_H 25 #define ARM_COMPUTE_ITENSORINFO_H 139 virtual size_t dimension(
size_t index)
const = 0;
270 template <
typename... Infos>
276 auto broadcast_valid_region = [&bc_valid_region](
const ITensorInfo &
info)
278 if(
info.num_dimensions() != 0)
280 for(
size_t d = 0; d < bc_valid_region.shape.num_dimensions(); ++d)
282 const bool is_broadcast = (
info.tensor_shape()[d] == 1);
284 const int anchor_max = std::max(bc_valid_region.anchor[d],
info.valid_region().anchor[d]);
285 const size_t valid_min = std::min(bc_valid_region.shape[d],
info.valid_region().shape[d]);
287 if(!is_broadcast || (valid_min == 0))
289 bc_valid_region.anchor.
set(d, anchor_max);
290 bc_valid_region.shape.
set(d, valid_min);
298 return std::pair<TensorShape, ValidRegion>(bc_shape, bc_valid_region);
virtual size_t num_dimensions() const =0
The number of dimensions of the tensor (rank)
virtual ITensorInfo & set_num_channels(int num_channels)=0
Set the number of channels to the specified value.
virtual int32_t offset_element_in_bytes(const Coordinates &pos) const =0
The offset in bytes from the beginning of the memory allocation to access the element at position (x...
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
Container for 2D border size.
virtual ITensorInfo & set_tensor_shape(const TensorShape &shape)=0
Set the shape of an already initialized tensor.
DataLayoutDimension
[DataLayout enum definition]
virtual DataType data_type() const =0
Data type used for each element of the tensor.
static TensorShape broadcast_shape(const Shapes &... shapes)
If shapes are broadcast compatible, return the broadcasted shape.
Store the tensor's metadata.
virtual bool is_dynamic() const =0
Flag indicating whether the shape of the tensor is dynamic, meaning that it can change on kernel/func...
virtual ITensorInfo & reset_padding()=0
Resets the padding settings of the tensor.
static std::pair< TensorShape, ValidRegion > broadcast_shape_and_valid_region(const Infos &... infos)
If infos are broadcast compatible tensor info's, return the broadcasted shape and the intersection of...
Copyright (c) 2017-2021 Arm Limited.
virtual void set_valid_region(const ValidRegion &valid_region)=0
Set the valid region of the tensor.
virtual ValidRegion valid_region() const =0
Valid region of the tensor.
virtual bool is_resizable() const =0
Flag indicating whether the size of the tensor can be changed.
Quantization information.
virtual Format format() const =0
Colour format of the image.
virtual bool auto_padding()=0
Update the offset to the first element and the strides to automatically computed values.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
virtual ITensorInfo & set_data_layout(const DataLayout &data_layout)=0
Set the data layout of the tensor.
Format
Image colour formats.
virtual size_t element_size() const =0
Element size in bytes calculated as data_size() * num_channels()
virtual PaddingSize padding() const =0
Padding of tensor.
virtual ITensorInfo & set_quantization_info(const QuantizationInfo &quantization_info)=0
Set the quantization settings (scale and offset) of the tensor.
virtual ITensorInfo & set_data_type(DataType data_type)=0
Set the data type to the specified value.
virtual QuantizationInfo quantization_info() const =0
Get the quantization settings (scale and offset) of the tensor.
void for_each(F &&)
Base case of for_each.
Strides of an item in bytes.
virtual size_t offset_first_element_in_bytes() const =0
The offset from the beginning of the memory allocation to the first element of the tensor...
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
virtual size_t total_size() const =0
Returns the total size of the tensor in bytes.
virtual const Strides & strides_in_bytes() const =0
The strides in bytes for accessing each dimension of the tensor.
virtual const TensorDimsState & tensor_dims_state() const =0
State of each dimension of the tensor shape.
Container for valid region of a window.
virtual ITensorInfo & set_format(Format format)=0
Set the format of an already initialized tensor.
DataType
Available data types.
virtual ~ITensorInfo()=default
Default virtual destructor.
DataLayout
[DataLayout enum definition]
virtual bool extend_padding(const PaddingSize &padding)=0
Update the offset to the first element, the strides and the total size.
virtual size_t num_channels() const =0
The number of channels for each tensor element.
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
virtual bool has_padding() const =0
Checks if the tensor has been allocated with padding or not.
virtual ITensorInfo & set_is_resizable(bool is_resizable)=0
Set the flag whether the tensor size can be changed.
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.
virtual ITensorInfo & set_tensor_dims_state(const TensorDimsState &state)=0
Set the state for each dimension of the tensor.