24.02.1
|
Store the tensor's metadata. More...
#include <TensorInfo.h>
Public Member Functions | |
TensorInfo () | |
Default constructor. More... | |
~TensorInfo ()=default | |
Default destructor. More... | |
TensorInfo (const ITensorInfo &info) | |
Allow instances of this class to be copy constructed. More... | |
TensorInfo (const TensorInfo &) | |
Allow instances of this class to be copy constructed. More... | |
TensorInfo & | operator= (const TensorInfo &)=default |
Allow instances of this class to be copied. More... | |
TensorInfo (TensorInfo &&)=default | |
Allow instances of this class to be move constructed. More... | |
TensorInfo & | operator= (TensorInfo &&)=default |
Allow instances of this class to be moved. More... | |
TensorInfo (Format format) | |
Construct a tensor info with a format. More... | |
TensorInfo (unsigned int width, unsigned int height, Format format) | |
2D tensor constructor More... | |
TensorInfo (const TensorShape &tensor_shape, Format format) | |
Constructor. More... | |
TensorInfo (size_t num_channels, DataType data_type) | |
Construct a tensor info with a data type and number of channels. More... | |
TensorInfo (const TensorShape &tensor_shape, size_t num_channels, DataType data_type) | |
Constructor. More... | |
TensorInfo (const TensorShape &tensor_shape, size_t num_channels, DataType data_type, DataLayout data_layout) | |
Constructor. More... | |
TensorInfo (const TensorShape &tensor_shape, size_t num_channels, DataType data_type, QuantizationInfo quantization_info) | |
Constructor. More... | |
void | init (Format format) |
Initialize the tensor info with just a format. More... | |
void | init (const TensorShape &tensor_shape, Format format) |
Initialize the metadata structure with the given parameters. More... | |
void | init (const TensorShape &tensor_shape, Format format, const Strides &strides_in_bytes, size_t offset_first_element_in_bytes, size_t total_size_in_bytes) |
Initialize the metadata structure with the given parameters. More... | |
void | init (size_t num_channels, DataType data_type) |
Initialize the tensor info with just a format. More... | |
void | init (const TensorShape &tensor_shape, size_t num_channels, DataType data_type) |
Initialize the metadata structure with the given parameters. More... | |
void | init (const TensorShape &tensor_shape, size_t num_channels, DataType data_type, const Strides &strides_in_bytes, size_t offset_first_element_in_bytes, size_t total_size_in_bytes) |
Initialize the metadata structure with the given parameters. More... | |
size_t | init_auto_padding (const TensorShape &tensor_shape, Format format) |
Initialize the metadata structure for the given tensor shape and single-plane format, (Padding is automatically calculated) More... | |
size_t | init_auto_padding (const TensorShape &tensor_shape, size_t num_channels, DataType data_type) |
Initialize the metadata structure for the given tensor shape, number of channels and data type. More... | |
std::unique_ptr< ITensorInfo > | clone () const override |
ITensorInfo & | set_data_type (DataType data_type) override |
Set the data type to the specified value. More... | |
ITensorInfo & | set_num_channels (int num_channels) override |
Set the number of channels to the specified value. More... | |
ITensorInfo & | set_format (Format format) override |
Set the format of an already initialized tensor. More... | |
ITensorInfo & | set_tensor_shape (const TensorShape &shape) override |
Set the shape of an already initialized tensor. More... | |
ITensorInfo & | set_tensor_dims_state (const TensorDimsState &state) override |
Set the state for each dimension of the tensor. More... | |
ITensorInfo & | set_quantization_info (const QuantizationInfo &quantization_info) override |
Set the quantization settings (scale and offset) of the tensor. More... | |
ITensorInfo & | set_data_layout (const DataLayout &data_layout) override |
Set the data layout of the tensor. More... | |
ITensorInfo & | reset_padding () override |
Resets the padding settings of the tensor. More... | |
bool | auto_padding () override |
Update the offset to the first element and the strides to automatically computed values. More... | |
ITensorInfo & | set_lock_paddings (bool flag) override |
Set the lock paddings flag of the tensor. More... | |
bool | lock_paddings () const override |
Get the lock paddings flag value. More... | |
bool | extend_padding (const PaddingSize &padding) override |
Update the offset to the first element, the strides and the total size. More... | |
size_t | dimension (size_t index) const override |
Return the size of the requested dimension. More... | |
size_t | dimension (DataLayoutDimension dimension) const override |
Return the size of the requested data layout dimension. More... | |
const Strides & | strides_in_bytes () const override |
The strides in bytes for accessing each dimension of the tensor. More... | |
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. More... | |
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, y, z ...) More... | |
size_t | element_size () const override |
Element size in bytes calculated as data_size() * num_channels() More... | |
size_t | num_dimensions () const override |
The number of dimensions of the tensor (rank) More... | |
size_t | num_channels () const override |
The number of channels for each tensor element. More... | |
const TensorShape & | tensor_shape () const override |
Size for each dimension of the tensor. More... | |
const TensorDimsState & | tensor_dims_state () const override |
State of each dimension of the tensor shape. More... | |
DataType | data_type () const override |
Data type used for each element of the tensor. More... | |
Format | format () const override |
Colour format of the image. More... | |
size_t | total_size () const override |
Returns the total size of the tensor in bytes. More... | |
PaddingSize | padding () const override |
Padding of tensor. More... | |
bool | has_padding () const override |
Checks if the tensor has been allocated with padding or not. More... | |
bool | is_resizable () const override |
Flag indicating whether the size of the tensor can be changed. More... | |
bool | is_dynamic () const override |
Flag indicating whether the shape of the tensor is dynamic, meaning that it can change on kernel/function execution. More... | |
bool | are_values_constant () const override |
Flag indicating whether the values of the tensor are constant, meaning that they can change on kernel/function execution. More... | |
ITensorInfo & | set_is_resizable (bool is_resizable) override |
Set the flag whether the tensor size can be changed. More... | |
ValidRegion | valid_region () const override |
Valid region of the tensor. More... | |
void | set_valid_region (const ValidRegion &valid_region) override |
Set the valid region of the tensor. More... | |
QuantizationInfo | quantization_info () const override |
Get the quantization settings (scale and offset) of the tensor. More... | |
DataLayout | data_layout () const override |
Get the data layout of the tensor. More... | |
ITensorInfo & | set_are_values_constant (bool are_values_constant) override |
Set the flag whether the tensor values can change during kernel/function execution. More... | |
ITensorInfo::Id | id () const override |
Get the workload tensor id of the tensor. More... | |
ITensorInfo & | set_id (ITensorInfo::Id id) override |
Set the tensor id. More... | |
Public Member Functions inherited from ITensorInfo | |
virtual | ~ITensorInfo ()=default |
Default virtual destructor. More... | |
bool | has_valid_id () const |
Check if the tensor id is valid. More... | |
Public Member Functions inherited from ICloneable< ITensorInfo > | |
virtual | ~ICloneable ()=default |
Default virtual desctructor. More... | |
virtual std::unique_ptr< ITensorInfo > | clone () const=0 |
Provide a clone of the current object of class T. More... | |
Friends | |
bool | operator== (const TensorInfo &lhs, const TensorInfo &rhs) |
Check whether two tensor info are equal. More... | |
Additional Inherited Members | |
Public Types inherited from ITensorInfo | |
using | TensorDimsState = std::vector< int > |
using | Id = int32_t |
An id that uniquely identifies an ITensorInfo within some domain (e.g. More... | |
Static Public Member Functions inherited from ITensorInfo | |
static constexpr int32_t | get_dynamic_state_value () |
Get the value representing dynamic dimension state. More... | |
static constexpr int32_t | get_static_state_value () |
Get the value representing static dimension state. More... | |
template<typename... Infos> | |
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 the broadcasted valid regions of the tensors. More... | |
Static Public Attributes inherited from ITensorInfo | |
static constexpr Id | invalid_tensor_id = 0 |
An invalid tensor id within a domain. More... | |
Store the tensor's metadata.
Definition at line 41 of file TensorInfo.h.
TensorInfo | ( | ) |
|
default |
Default destructor.
TensorInfo | ( | const ITensorInfo & | info | ) |
Allow instances of this class to be copy constructed.
Definition at line 57 of file TensorInfo.cpp.
References ScaleKernelInfo::data_layout, and arm_compute::test::validation::info.
TensorInfo | ( | const TensorInfo & | info | ) |
Allow instances of this class to be copy constructed.
Definition at line 77 of file TensorInfo.cpp.
References ScaleKernelInfo::data_layout, and arm_compute::test::validation::info.
|
default |
Allow instances of this class to be move constructed.
TensorInfo | ( | Format | format | ) |
Construct a tensor info with a format.
Can be used for automatic derivation of the shape by the function.
[in] | format | Format of the tensor. |
Definition at line 96 of file TensorInfo.cpp.
TensorInfo | ( | unsigned int | width, |
unsigned int | height, | ||
Format | format | ||
) |
2D tensor constructor
[in] | width | Width of the 2D tensor |
[in] | height | Height of the 2D tensor |
[in] | format | Single plane format of the tensor. |
Definition at line 100 of file TensorInfo.cpp.
TensorInfo | ( | const TensorShape & | tensor_shape, |
Format | format | ||
) |
Constructor.
[in] | tensor_shape | It specifies the size for each dimension of the tensor in number of elements. |
[in] | format | Single plane format of the tensor. |
Definition at line 105 of file TensorInfo.cpp.
References TensorInfo::format(), TensorInfo::init(), and TensorInfo::tensor_shape().
TensorInfo | ( | size_t | num_channels, |
DataType | data_type | ||
) |
Construct a tensor info with a data type and number of channels.
Can be used for automatic derivation of the shape by the function.
[in] | num_channels | It indicates the number of channels for each tensor element |
[in] | data_type | Data type to use for each tensor element |
Definition at line 110 of file TensorInfo.cpp.
References TensorInfo::data_type(), TensorInfo::init(), and TensorInfo::num_channels().
TensorInfo | ( | const TensorShape & | tensor_shape, |
size_t | num_channels, | ||
DataType | data_type | ||
) |
Constructor.
[in] | tensor_shape | It specifies the size for each dimension of the tensor in number of elements. |
[in] | num_channels | It indicates the number of channels for each tensor element |
[in] | data_type | Data type to use for each tensor element |
Definition at line 115 of file TensorInfo.cpp.
References TensorInfo::data_type(), TensorInfo::init(), TensorInfo::num_channels(), and TensorInfo::tensor_shape().
TensorInfo | ( | const TensorShape & | tensor_shape, |
size_t | num_channels, | ||
DataType | data_type, | ||
DataLayout | data_layout | ||
) |
Constructor.
[in] | tensor_shape | It specifies the size for each dimension of the tensor in number of elements. |
[in] | num_channels | It indicates the number of channels for each tensor element |
[in] | data_type | Data type to use for each tensor element |
[in] | data_layout | The data layout setting for the tensor data. |
Definition at line 130 of file TensorInfo.cpp.
References TensorInfo::data_layout(), TensorInfo::data_type(), TensorInfo::init(), TensorInfo::num_channels(), and TensorInfo::tensor_shape().
TensorInfo | ( | const TensorShape & | tensor_shape, |
size_t | num_channels, | ||
DataType | data_type, | ||
QuantizationInfo | quantization_info | ||
) |
Constructor.
[in] | tensor_shape | It specifies the size for each dimension of the tensor in number of elements. |
[in] | num_channels | It indicates the number of channels for each tensor element |
[in] | data_type | Data type to use for each tensor element |
[in] | quantization_info | The quantization settings for the tensor data. |
Definition at line 120 of file TensorInfo.cpp.
References TensorInfo::data_type(), TensorInfo::init(), TensorInfo::num_channels(), TensorInfo::quantization_info(), and TensorInfo::tensor_shape().
|
inlineoverridevirtual |
Flag indicating whether the values of the tensor are constant, meaning that they can change on kernel/function execution.
Implements ITensorInfo.
Definition at line 282 of file TensorInfo.h.
Referenced by TensorInfo::set_are_values_constant().
|
overridevirtual |
Update the offset to the first element and the strides to automatically computed values.
Implements ITensorInfo.
Definition at line 229 of file TensorInfo.cpp.
References ARM_COMPUTE_ERROR_ON, TensorInfo::extend_padding(), and Dimensions< T >::num_dimensions().
Referenced by TensorInfo::init_auto_padding().
|
override |
Definition at line 334 of file TensorInfo.cpp.
Referenced by CLFFTConvolutionLayer::configure(), CPPSplit< CLSlice, ICLTensor >::validate(), NELSTMLayerQuantized::validate(), CLGEMMDeconvolutionLayer::validate(), and CLLSTMLayerQuantized::validate().
|
inlineoverridevirtual |
Get the data layout of the tensor.
Implements ITensorInfo.
Definition at line 303 of file TensorInfo.h.
Referenced by arm_compute::calculate_valid_region_scale(), CLAccessor::data_layout(), arm_compute::error_on_data_layout_not_in(), arm_compute::error_on_mismatching_data_layouts(), TensorInfo::set_data_layout(), and TensorInfo::TensorInfo().
|
inlineoverridevirtual |
Data type used for each element of the tensor.
Implements ITensorInfo.
Definition at line 253 of file TensorInfo.h.
Referenced by CLLSTMLayer::configure(), CLAccessor::data_type(), arm_compute::error_on_data_type_not_in(), arm_compute::error_on_mismatching_data_types(), arm_compute::error_on_unsupported_cpu_bf16(), arm_compute::error_on_unsupported_cpu_fp16(), arm_compute::error_on_unsupported_fp16(), TensorInfo::init(), TensorInfo::init_auto_padding(), TensorInfo::set_data_type(), TensorInfo::TensorInfo(), NEQLSTMLayer::validate(), and CLQLSTMLayer::validate().
|
inlineoverridevirtual |
Return the size of the requested data layout dimension.
[in] | dimension | DataLayoutDimension of the dimension |
Implements ITensorInfo.
Definition at line 220 of file TensorInfo.h.
References TensorInfo::dimension(), and arm_compute::get_data_layout_dimension_index().
|
inlineoverridevirtual |
Return the size of the requested dimension.
[in] | index | Index of the dimension |
Implements ITensorInfo.
Definition at line 216 of file TensorInfo.h.
Referenced by ITensor::copy_from(), TensorInfo::dimension(), and NEDeconvolutionLayer::validate().
|
inlineoverridevirtual |
Element size in bytes calculated as data_size() * num_channels()
Implements ITensorInfo.
Definition at line 233 of file TensorInfo.h.
References arm_compute::data_size_from_type().
Referenced by ITensor::copy_from(), CLAccessor::element_size(), and CLQLSTMLayer::prepare().
|
overridevirtual |
Update the offset to the first element, the strides and the total size.
[in] | padding | Padding around the XY plane in number of elements. |
Implements ITensorInfo.
Definition at line 298 of file TensorInfo.cpp.
References ARM_COMPUTE_ERROR_ON, BorderSize::bottom, BorderSize::left, TensorInfo::padding(), BorderSize::right, and BorderSize::top.
Referenced by TensorInfo::auto_padding(), and CpuGemmConv2d::run().
|
inlineoverridevirtual |
Colour format of the image.
Implements ITensorInfo.
Definition at line 257 of file TensorInfo.h.
Referenced by CLAccessor::format(), TensorAllocator::init(), TensorInfo::init(), TensorInfo::init_auto_padding(), TensorInfo::set_format(), and TensorInfo::TensorInfo().
|
inlineoverridevirtual |
Checks if the tensor has been allocated with padding or not.
Implements ITensorInfo.
Definition at line 269 of file TensorInfo.h.
References BorderSize::empty().
|
inlineoverridevirtual |
Get the workload tensor id of the tensor.
Implements ITensorInfo.
Definition at line 312 of file TensorInfo.h.
Referenced by GpuKernelArgument::id(), GpuWorkloadArgument::id(), and TensorInfo::set_id().
void init | ( | const TensorShape & | tensor_shape, |
Format | format | ||
) |
Initialize the metadata structure with the given parameters.
[in] | tensor_shape | Size for each dimension of the tensor in number of elements. |
[in] | format | Single plane format of the tensor. |
Definition at line 142 of file TensorInfo.cpp.
References arm_compute::data_type_from_format(), TensorInfo::format(), TensorInfo::init(), TensorInfo::num_channels(), arm_compute::num_channels_from_format(), TensorInfo::tensor_shape(), and type.
void init | ( | const TensorShape & | tensor_shape, |
Format | format, | ||
const Strides & | strides_in_bytes, | ||
size_t | offset_first_element_in_bytes, | ||
size_t | total_size_in_bytes | ||
) |
Initialize the metadata structure with the given parameters.
[in] | tensor_shape | Size for each dimension of the tensor in number of elements. |
[in] | format | Single plane format of the tensor. |
[in] | strides_in_bytes | Stride in bytes for accessing each dimension of the tensor. |
[in] | offset_first_element_in_bytes | Offset in bytes from the beginning of memory allocation to access the first element. |
[in] | total_size_in_bytes | Size in bytes of the memory allocation (including the offset to the first element). |
Definition at line 152 of file TensorInfo.cpp.
References arm_compute::data_type_from_format(), TensorInfo::format(), TensorInfo::init(), TensorInfo::num_channels(), arm_compute::num_channels_from_format(), TensorInfo::offset_first_element_in_bytes(), TensorInfo::strides_in_bytes(), TensorInfo::tensor_shape(), and type.
void init | ( | const TensorShape & | tensor_shape, |
size_t | num_channels, | ||
DataType | data_type | ||
) |
Initialize the metadata structure with the given parameters.
[in] | tensor_shape | Size for each dimension of the tensor in number of elements. |
[in] | num_channels | Desired number of channels for each tensor element. |
[in] | data_type | Data type to use for each tensor element. |
Definition at line 171 of file TensorInfo.cpp.
References ARM_COMPUTE_ERROR_ON, TensorInfo::data_type(), TensorInfo::num_channels(), TensorInfo::set_tensor_shape(), TensorInfo::tensor_shape(), and arm_compute::UNKNOWN.
void init | ( | const TensorShape & | tensor_shape, |
size_t | num_channels, | ||
DataType | data_type, | ||
const Strides & | strides_in_bytes, | ||
size_t | offset_first_element_in_bytes, | ||
size_t | total_size_in_bytes | ||
) |
Initialize the metadata structure with the given parameters.
[in] | tensor_shape | Size for each dimension of the tensor in number of elements. |
[in] | num_channels | Desired number of channels for each tensor element. |
[in] | data_type | Data type to use for each tensor element. |
[in] | strides_in_bytes | Stride in bytes for accessing each dimension of the tensor. |
[in] | offset_first_element_in_bytes | Offset in bytes from the beginning of memory allocation to access the first element. |
[in] | total_size_in_bytes | Size in bytes of the memory allocation (including the offset to the first element). |
Definition at line 182 of file TensorInfo.cpp.
References ARM_COMPUTE_ERROR_ON, TensorInfo::data_type(), TensorInfo::num_channels(), TensorInfo::offset_first_element_in_bytes(), TensorInfo::strides_in_bytes(), TensorInfo::tensor_shape(), and arm_compute::UNKNOWN.
void init | ( | Format | format | ) |
Initialize the tensor info with just a format.
Can be used for automatic derivation of the shape by the function.
[in] | format | Single plane format of the tensor. |
Definition at line 137 of file TensorInfo.cpp.
References TensorInfo::format().
Referenced by CpuWinogradConv2d::configure(), arm_compute::detail::convert_to_legacy_tensor_info(), TensorAllocator::init(), TensorInfo::init(), and TensorInfo::TensorInfo().
void init | ( | size_t | num_channels, |
DataType | data_type | ||
) |
Initialize the tensor info with just a format.
Can be used for automatic derivation of the shape by the function.
[in] | num_channels | Desired number of channels for each tensor element. |
[in] | data_type | Data type to use for each tensor element. |
Definition at line 166 of file TensorInfo.cpp.
References TensorInfo::data_type(), TensorInfo::init(), and TensorInfo::num_channels().
size_t init_auto_padding | ( | const TensorShape & | tensor_shape, |
Format | format | ||
) |
Initialize the metadata structure for the given tensor shape and single-plane format, (Padding is automatically calculated)
[in] | tensor_shape | It specifies the size for each dimension of the tensor in number of elements |
[in] | format | Single plane format of the image. |
Definition at line 202 of file TensorInfo.cpp.
References arm_compute::data_type_from_format(), TensorInfo::format(), TensorInfo::num_channels(), arm_compute::num_channels_from_format(), TensorInfo::tensor_shape(), TensorInfo::total_size(), and type.
size_t init_auto_padding | ( | const TensorShape & | tensor_shape, |
size_t | num_channels, | ||
DataType | data_type | ||
) |
Initialize the metadata structure for the given tensor shape, number of channels and data type.
(Padding is automatically calculated)
[in] | tensor_shape | It specifies the size for each dimension of the tensor in number of elements |
[in] | num_channels | It indicates the number of channels for each tensor element |
[in] | data_type | Data type to use for each tensor element |
Definition at line 213 of file TensorInfo.cpp.
References ARM_COMPUTE_ERROR_ON, TensorInfo::auto_padding(), TensorInfo::data_type(), TensorInfo::num_channels(), TensorInfo::tensor_shape(), and arm_compute::UNKNOWN.
|
inlineoverridevirtual |
Flag indicating whether the shape of the tensor is dynamic, meaning that it can change on kernel/function execution.
Implements ITensorInfo.
Definition at line 277 of file TensorInfo.h.
References ITensorInfo::get_dynamic_state_value().
|
inlineoverridevirtual |
Flag indicating whether the size of the tensor can be changed.
Implements ITensorInfo.
Definition at line 273 of file TensorInfo.h.
Referenced by TensorInfo::set_is_resizable(), and arm_compute::test::validation::TEST_CASE().
|
overridevirtual |
Get the lock paddings flag value.
Implements ITensorInfo.
Definition at line 293 of file TensorInfo.cpp.
|
inlineoverridevirtual |
The number of channels for each tensor element.
Implements ITensorInfo.
Definition at line 241 of file TensorInfo.h.
Referenced by ITensor::copy_from(), arm_compute::error_on_data_type_channel_not_in(), TensorInfo::init(), TensorInfo::init_auto_padding(), CLAccessor::num_channels(), TensorInfo::set_num_channels(), and TensorInfo::TensorInfo().
|
inlineoverridevirtual |
The number of dimensions of the tensor (rank)
Implements ITensorInfo.
Definition at line 237 of file TensorInfo.h.
References Dimensions< T >::num_dimensions().
Referenced by ITensor::copy_from(), and CpuReshapeKernel::prepare().
|
overridevirtual |
The offset in bytes from the beginning of the memory allocation to access the element at position (x, y, z ...)
[in] | pos | Vector with the coordinates of the element to access. The size of this vector must be equal to the number of dimensions of the tensor |
Implements ITensorInfo.
Definition at line 421 of file TensorInfo.cpp.
References ARM_COMPUTE_ERROR_ON_COORDINATES_DIMENSIONS_GTE, Dimensions< T >::num_dimensions(), and offset().
Referenced by TensorAllocator::init().
|
inlineoverridevirtual |
The offset from the beginning of the memory allocation to the first element of the tensor.
This can be used to access efficiently elements in a 2D tensor
Implements ITensorInfo.
Definition at line 228 of file TensorInfo.h.
Referenced by TensorAllocator::init(), TensorInfo::init(), and ClSoftmaxKernel::run_op().
|
default |
Allow instances of this class to be copied.
|
default |
Allow instances of this class to be moved.
|
inlineoverridevirtual |
Padding of tensor.
Implements ITensorInfo.
Definition at line 265 of file TensorInfo.h.
Referenced by TensorInfo::extend_padding(), arm_compute::get_padding_info(), and CLAccessor::padding().
|
inlineoverridevirtual |
Get the quantization settings (scale and offset) of the tensor.
Implements ITensorInfo.
Definition at line 299 of file TensorInfo.h.
Referenced by CpuGemmLowpMatrixMultiplyCore::configure(), CLQLSTMLayer::configure(), CLAccessor::quantization_info(), TensorInfo::set_quantization_info(), and TensorInfo::TensorInfo().
|
overridevirtual |
Resets the padding settings of the tensor.
Implements ITensorInfo.
Definition at line 410 of file TensorInfo.cpp.
References arm_compute::UNKNOWN.
|
inlineoverridevirtual |
Set the flag whether the tensor values can change during kernel/function execution.
[in] | are_values_constant | Flag that marks the tensor values if they can be changed or not. |
Implements ITensorInfo.
Definition at line 307 of file TensorInfo.h.
References TensorInfo::are_values_constant().
Referenced by CpuFullyConnected::configure().
|
overridevirtual |
Set the data layout of the tensor.
[in] | data_layout | DataLayout containing the layout data information. |
Implements ITensorInfo.
Definition at line 404 of file TensorInfo.cpp.
References TensorInfo::data_layout().
Referenced by NECropResize::configure(), CLDepthwiseConvolutionLayer::configure(), CLCropResize::configure(), NEDeconvolutionLayer::configure(), CLFFTConvolutionLayer::configure(), CLDirectDeconvolutionLayer::configure(), and NEQLSTMLayer::configure().
|
overridevirtual |
Set the data type to the specified value.
[in] | data_type | The new data type. |
Implements ITensorInfo.
Definition at line 339 of file TensorInfo.cpp.
References TensorInfo::data_type(), TensorInfo::set_tensor_shape(), TensorInfo::tensor_shape(), and arm_compute::UNKNOWN.
Referenced by CpuSoftmaxKernel::configure(), CLReduceMean::configure(), ClGemmLowpMatrixMultiplyCore::configure(), CpuGemmConv2d::configure(), NEL2NormalizeLayer::validate(), NEReductionOperation::validate(), CLL2NormalizeLayer::validate(), CLArgMinMaxLayer::validate(), CLReductionOperation::validate(), NEGenerateProposalsLayer::validate(), CLGEMMDeconvolutionLayer::validate(), and CLGenerateProposalsLayer::validate().
|
overridevirtual |
Set the format of an already initialized tensor.
[in] | format | Single-plane format of the tensor. |
Implements ITensorInfo.
Definition at line 353 of file TensorInfo.cpp.
References ARM_COMPUTE_ERROR_ON, arm_compute::data_type_from_format(), TensorInfo::format(), arm_compute::num_channels_from_format(), and arm_compute::UNKNOWN.
|
inlineoverridevirtual |
Set the tensor id.
Implements ITensorInfo.
Definition at line 316 of file TensorInfo.h.
References TensorInfo::id().
|
inlineoverridevirtual |
Set the flag whether the tensor size can be changed.
[in] | is_resizable | Flag that marks the tensor if it can be changed or not. |
Implements ITensorInfo.
Definition at line 286 of file TensorInfo.h.
References TensorInfo::is_resizable().
Referenced by TensorAllocator::allocate(), CLTensorAllocator::allocate(), CpuContext::create_activation(), ClContext::create_activation(), TensorAllocator::free(), CLTensorAllocator::free(), TensorAllocator::import_memory(), CLTensorAllocator::import_memory(), and TensorAllocator::~TensorAllocator().
|
overridevirtual |
Set the lock paddings flag of the tensor.
It should be set to True, when the tensor could be mapped to camera or frame buffer.
Implements ITensorInfo.
Definition at line 287 of file TensorInfo.cpp.
|
overridevirtual |
Set the number of channels to the specified value.
[in] | num_channels | New number of channels. |
Implements ITensorInfo.
Definition at line 346 of file TensorInfo.cpp.
References TensorInfo::num_channels(), and arm_compute::UNKNOWN.
|
overridevirtual |
Set the quantization settings (scale and offset) of the tensor.
[in] | quantization_info | QuantizationInfo containing the scale and offset |
Implements ITensorInfo.
Definition at line 398 of file TensorInfo.cpp.
References TensorInfo::quantization_info().
Referenced by CpuSoftmaxKernel::configure(), CLDepthwiseConvolutionLayer::configure(), CpuGemmConv2d::configure(), ClGemmConv2d::configure(), CLGEMMDeconvolutionLayer::configure(), CLLSTMLayerQuantized::configure(), NELSTMLayerQuantized::validate(), and CLLSTMLayerQuantized::validate().
|
overridevirtual |
Set the state for each dimension of the tensor.
This sets the state of each dimension of the shape in terms of dynamic behavior using -1 where appropriate. The index in the state is a 1 to 1 mapping with the shape dimension index. For example if you want to express [?, 3, 3] as a dynamic input then [-1, 3, 3] has to be set as a state
[in] | state | Tensor dimensions state |
Implements ITensorInfo.
Definition at line 392 of file TensorInfo.cpp.
|
overridevirtual |
Set the shape of an already initialized tensor.
[in] | shape | New tensor shape. |
Implements ITensorInfo.
Definition at line 370 of file TensorInfo.cpp.
References arm_compute::compute_strides(), Dimensions< T >::num_dimensions(), and arm_compute::test::validation::shape.
Referenced by CpuMatMul::configure(), NEQLSTMLayer::configure(), CLQLSTMLayer::configure(), TensorInfo::init(), TensorInfo::set_data_type(), NEL2NormalizeLayer::validate(), CLL2NormalizeLayer::validate(), CLDepthwiseConvolutionLayer::validate(), NEQLSTMLayer::validate(), and CLQLSTMLayer::validate().
|
inlineoverridevirtual |
Set the valid region of the tensor.
[in] | valid_region | Valid region to set. |
Implements ITensorInfo.
Definition at line 295 of file TensorInfo.h.
References TensorInfo::valid_region().
|
inlineoverridevirtual |
The strides in bytes for accessing each dimension of the tensor.
Implements ITensorInfo.
Definition at line 224 of file TensorInfo.h.
Referenced by TensorAllocator::init(), TensorInfo::init(), and ClSoftmaxKernel::run_op().
|
inlineoverridevirtual |
State of each dimension of the tensor shape.
Implements ITensorInfo.
Definition at line 249 of file TensorInfo.h.
|
inlineoverridevirtual |
Size for each dimension of the tensor.
Implements ITensorInfo.
Definition at line 245 of file TensorInfo.h.
Referenced by arm_compute::calculate_valid_region_scale(), CpuMatMul::configure(), CpuGemmConv2d::configure(), ClGemmConv2d::configure(), CLFFTConvolutionLayer::configure(), CLGenerateProposalsLayer::configure(), NEQLSTMLayer::configure(), CLLSTMLayerQuantized::configure(), CLLSTMLayer::configure(), CLQLSTMLayer::configure(), ITensor::copy_from(), TensorAllocator::init(), TensorInfo::init(), TensorInfo::init_auto_padding(), CLAccessor::num_elements(), CpuReshapeKernel::prepare(), CpuElementwiseUnary::run(), TensorInfo::set_data_type(), CLAccessor::shape(), TensorInfo::TensorInfo(), CPPSplit< CLSlice, ICLTensor >::validate(), NELSTMLayerQuantized::validate(), and CLLSTMLayerQuantized::validate().
|
inlineoverridevirtual |
Returns the total size of the tensor in bytes.
Implements ITensorInfo.
Definition at line 261 of file TensorInfo.h.
Referenced by TensorAllocator::allocate(), CpuAddMulAdd::configure(), ClSoftmax::configure(), CpuSoftmaxGeneric::configure(), CpuWinogradConv2d::configure(), CpuFullyConnected::configure(), ClFullyConnected::configure(), ClGemmLowpMatrixMultiplyCore::configure(), ClWinogradConv2d::configure(), CpuGemmConv2d::configure(), ClGemmConv2d::configure(), CpuGemmLowpMatrixMultiplyCore::configure(), TensorAllocator::init(), TensorInfo::init_auto_padding(), CLQLSTMLayer::prepare(), ClSoftmaxKernel::run_op(), and CLAccessor::size().
|
inlineoverridevirtual |
Valid region of the tensor.
All elements in the valid region have defined values, i.e. are not undefined.
Implements ITensorInfo.
Definition at line 291 of file TensorInfo.h.
Referenced by arm_compute::calculate_valid_region_scale(), ITensor::copy_from(), and TensorInfo::set_valid_region().
|
friend |
Check whether two tensor info are equal.
[in] | lhs | LHS tensor info. |
[in] | rhs | RHS tensor info. |
Definition at line 355 of file TensorInfo.h.