24 #ifndef __ARM_COMPUTE_ITENSORINFO_H__ 25 #define __ARM_COMPUTE_ITENSORINFO_H__ 134 virtual size_t dimension(
size_t index)
const = 0;
259 template <
typename... Infos>
265 auto broadcast_valid_region = [&bc_valid_region](
const ITensorInfo &
info)
267 if(
info.num_dimensions() != 0)
269 for(
size_t d = 0; d < bc_valid_region.shape.num_dimensions(); ++d)
271 const bool is_broadcast = (
info.tensor_shape()[d] == 1);
273 const int anchor_max =
std::max(bc_valid_region.anchor[d],
info.valid_region().anchor[d]);
274 const size_t valid_min =
std::min(bc_valid_region.shape[d],
info.valid_region().shape[d]);
276 if(!is_broadcast || (valid_min == 0))
278 bc_valid_region.anchor.set(d, anchor_max);
279 bc_valid_region.shape.set(d, valid_min);
287 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.
fixed_point< T > min(fixed_point< T > x, fixed_point< T > y)
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
Container for 2D border size.
virtual ITensorInfo & set_fixed_point_position(int fixed_point_position)=0
Set the fixed point position to the specified value.
virtual ITensorInfo & set_tensor_shape(const TensorShape &shape)=0
Set the shape of an already initialized tensor.
DataLayoutDimension
Supported tensor data layout dimensions.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
virtual size_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...
Store the tensor's metadata.
virtual ITensorInfo & reset_padding()=0
Resets the padding settings of the tensor.
src info() -> set_format(Format::S16)
This file contains all available output stages for GEMMLowp on OpenCL.
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.
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 int fixed_point_position() const =0
Fixed point position used when the tensor data type is QS8 or QS16.
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.
static TensorShape broadcast_shape(const Shapes &...shapes)
If shapes are broadcast compatible, return the broadcasted shape.
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...
virtual size_t total_size() const =0
Returns the total size of the tensor in bytes.
fixed_point< T > max(fixed_point< T > x, fixed_point< T > y)
Quantization settings (used for QASYMM8 data type)
virtual const Strides & strides_in_bytes() const =0
The strides in bytes for accessing each dimension of the tensor.
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
Supported tensor data layouts.
virtual bool extend_padding(const PaddingSize &padding)=0
Update the offset to the first element, the strides and the total size.
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...
virtual size_t num_channels() const =0
The number of channels for each tensor element.
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.