24.02.1
|
Go to the documentation of this file.
24 #ifndef ARM_COMPUTE_TENSORINFO_H
25 #define ARM_COMPUTE_TENSORINFO_H
145 size_t total_size_in_bytes);
178 size_t total_size_in_bytes);
203 std::unique_ptr<ITensorInfo>
clone()
const override;
218 return _tensor_shape[index];
226 return _strides_in_bytes;
230 return _offset_first_element_in_bytes;
243 return _num_channels;
247 return _tensor_shape;
271 return !_padding.
empty();
275 return _is_resizable;
280 std::cend(_dims_state);
284 return _are_values_constant;
293 return _valid_region;
301 return _quantization_info;
328 std::tuple<Strides, size_t, size_t> calculate_padding_requirements(
const PaddingSize &
padding);
331 size_t _offset_first_element_in_bytes;
333 size_t _num_channels;
343 bool _are_values_constant;
357 return (lhs._total_size == rhs._total_size) &&
358 (lhs._offset_first_element_in_bytes == rhs._offset_first_element_in_bytes) &&
359 (lhs._strides_in_bytes == rhs._strides_in_bytes) && (lhs._num_channels == rhs._num_channels) &&
360 (lhs._tensor_shape == rhs._tensor_shape) && (lhs._dims_state == rhs._dims_state) &&
361 (lhs._data_type == rhs._data_type) && (lhs._format == rhs._format) &&
362 (lhs._is_resizable == rhs._is_resizable) && (lhs._valid_region == rhs._valid_region) &&
363 (lhs._padding == rhs._padding) && (lhs._quantization_info == rhs._quantization_info) &&
364 (lhs._data_layout == rhs._data_layout) && (lhs._are_values_constant == rhs._are_values_constant) &&
365 (lhs._id == rhs._id);
bool has_padding() const override
Checks if the tensor has been allocated with padding or not.
std::unique_ptr< ITensorInfo > clone() const override
void set_valid_region(const ValidRegion &valid_region) override
Set the valid region of the tensor.
static constexpr int32_t get_dynamic_state_value()
Get the value representing dynamic dimension state.
ITensorInfo & set_format(Format format) override
Set the format of an already initialized tensor.
Quantization information.
size_t num_channels() const override
The number of channels for each tensor element.
DataLayout
[DataLayout enum definition]
Container for 2D border size.
DataLayoutDimension
[DataLayout enum definition]
size_t init_auto_padding(const TensorShape &tensor_shape, Format format)
Initialize the metadata structure for the given tensor shape and single-plane format,...
ITensorInfo & set_lock_paddings(bool flag) override
Set the lock paddings flag of the tensor.
bool is_resizable() const override
Flag indicating whether the size of the tensor can be changed.
bool extend_padding(const PaddingSize &padding) override
Update the offset to the first element, the strides and the total size.
bool is_dynamic() const override
Flag indicating whether the shape of the tensor is dynamic, meaning that it can change on kernel/func...
ValidRegion valid_region() const override
Valid region of the tensor.
DataLayout data_layout() const override
Get the data layout of the tensor.
ITensorInfo & reset_padding() override
Resets the padding settings of the tensor.
const Strides & strides_in_bytes() const override
The strides in bytes for accessing each dimension of the tensor.
size_t dimension(size_t index) const override
Return the size of the requested dimension.
QuantizationInfo quantization_info() const override
Get the quantization settings (scale and offset) of the tensor.
constexpr bool empty() const
Check if the entire border is zero.
ITensorInfo & set_data_type(DataType data_type) override
Set the data type to the specified value.
DataType data_type() const override
Data type used for each element of the tensor.
size_t dimension(DataLayoutDimension dimension) const override
Return the size of the requested data layout dimension.
PaddingSize padding() const override
Padding of tensor.
bool operator==(const Dimensions< T > &lhs, const Dimensions< T > &rhs)
Check that given dimensions are equal.
Strides of an item in bytes.
size_t num_dimensions() const override
The number of dimensions of the tensor (rank)
bool auto_padding() override
Update the offset to the first element and the strides to automatically computed values.
ITensorInfo & set_quantization_info(const QuantizationInfo &quantization_info) override
Set the quantization settings (scale and offset) of the tensor.
size_t data_size_from_type(DataType data_type)
The size in bytes of the data type.
Format format() const override
Colour format of the image.
size_t total_size() const override
Returns the total size of the tensor in bytes.
ITensorInfo & set_data_layout(const DataLayout &data_layout) override
Set the data layout of the tensor.
Container for valid region of a window.
int32_t Id
An id that uniquely identifies an ITensorInfo within some domain (e.g.
ITensorInfo & set_num_channels(int num_channels) override
Set the number of channels to the specified value.
const TensorDimsState & tensor_dims_state() const override
State of each dimension of the tensor shape.
ITensorInfo & set_are_values_constant(bool are_values_constant) override
Set the flag whether the tensor values can change during kernel/function execution.
void init(Format format)
Initialize the tensor info with just a format.
ITensorInfo & set_is_resizable(bool is_resizable) override
Set the flag whether the tensor size can be changed.
Format
Image colour formats.
ITensorInfo & set_tensor_dims_state(const TensorDimsState &state) override
Set the state for each dimension of the tensor.
friend bool operator==(const TensorInfo &lhs, const TensorInfo &rhs)
Check whether two tensor info are equal.
bool are_values_constant() const override
Flag indicating whether the values of the tensor are constant, meaning that they can change on kernel...
bool lock_paddings() const override
Get the lock paddings flag value.
size_t get_data_layout_dimension_index(const DataLayout &data_layout, const DataLayoutDimension &data_layout_dimension)
Get the index of the given dimension.
std::vector< int > TensorDimsState
Store the tensor's metadata.
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,...
Copyright (c) 2017-2024 Arm Limited.
TensorInfo()
Default constructor.
ITensorInfo::Id id() const override
Get the workload tensor id of the tensor.
Store the tensor's metadata.
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.
ITensorInfo & set_tensor_shape(const TensorShape &shape) override
Set the shape of an already initialized tensor.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
~TensorInfo()=default
Default destructor.
TensorInfo & operator=(const TensorInfo &)=default
Allow instances of this class to be copied.
unsigned int num_dimensions() const
Returns the effective dimensionality of the tensor.
ITensorInfo & set_id(ITensorInfo::Id id) override
Set the tensor id.
DataType
Available data types.
const TensorShape & tensor_shape() const override
Size for each dimension of the tensor.
size_t element_size() const override
Element size in bytes calculated as data_size() * num_channels()