24.02.1
|
Subclass of SimpleTensor using uint8_t as value type. More...
#include <RawTensor.h>
Public Member Functions | |
RawTensor (TensorShape shape, Format format) | |
Create an uninitialised tensor of the given shape and format . More... | |
RawTensor (TensorShape shape, DataType data_type, int num_channels=1) | |
Create an uninitialised tensor of the given shape and data type. More... | |
template<typename T > | |
RawTensor (SimpleTensor< T > &&tensor) | |
Conversion constructor from SimpleTensor. More... | |
template<typename T > | |
operator SimpleTensor< T > () | |
Conversion operator to SimpleTensor. More... | |
RawTensor (const RawTensor &tensor) | |
Create a deep copy of the given tensor . More... | |
RawTensor & | operator= (RawTensor tensor) |
Copy the given tensor . More... | |
RawTensor (RawTensor &&)=default | |
Allow instances of this class to be move constructed. More... | |
~RawTensor ()=default | |
Default destructor. More... | |
const void * | operator() (const Coordinates &coord) const override |
Read only access to the specified element. More... | |
void * | operator() (const Coordinates &coord) override |
Access to the specified element. More... | |
Public Member Functions inherited from SimpleTensor< uint8_t > | |
SimpleTensor ()=default | |
Create an uninitialised tensor. More... | |
SimpleTensor (TensorShape shape, Format format) | |
Create an uninitialised tensor of the given shape and format . More... | |
SimpleTensor (TensorShape shape, DataType data_type, int num_channels=1, QuantizationInfo quantization_info=QuantizationInfo(), DataLayout data_layout=DataLayout::NCHW) | |
Create an uninitialised tensor of the given shape and data type. More... | |
SimpleTensor (const SimpleTensor &tensor) | |
Create a deep copy of the given tensor . More... | |
SimpleTensor (SimpleTensor &&)=default | |
Allow instances of this class to be move constructed. More... | |
SimpleTensor & | operator= (SimpleTensor tensor) |
Create a deep copy of the given tensor . More... | |
~SimpleTensor ()=default | |
Default destructor. More... | |
uint8_t & | operator[] (size_t offset) |
Return value at offset in the buffer. More... | |
const uint8_t & | operator[] (size_t offset) const |
Return constant value at offset in the buffer. More... | |
TensorShape | shape () const override |
Shape of the tensor. More... | |
size_t | element_size () const override |
Size of each element in the tensor in bytes. More... | |
size_t | size () const override |
Total size of the tensor in bytes. More... | |
Format | format () const override |
Image format of the tensor. More... | |
DataLayout | data_layout () const override |
Data layout of the tensor. More... | |
DataType | data_type () const override |
Data type of the tensor. More... | |
int | num_channels () const override |
Number of channels of the tensor. More... | |
int | num_elements () const override |
Number of elements of the tensor. More... | |
PaddingSize | padding () const override |
Available padding around the tensor. More... | |
QuantizationInfo | quantization_info () const override |
Quantization info in case of asymmetric quantized type. More... | |
SimpleTensor< uint8_t > & | quantization_info (const QuantizationInfo &qinfo) |
Set the quantization information of the tensor. More... | |
const uint8_t * | data () const |
Constant pointer to the underlying buffer. More... | |
uint8_t * | data () |
Pointer to the underlying buffer. More... | |
const void * | operator() (const Coordinates &coord) const override |
Read only access to the specified element. More... | |
void * | operator() (const Coordinates &coord) override |
Access to the specified element. More... | |
Public Member Functions inherited from IAccessor | |
virtual | ~IAccessor ()=default |
Virtual destructor. More... | |
virtual TensorShape | shape () const =0 |
Shape of the tensor. More... | |
virtual size_t | element_size () const =0 |
Size of each element in the tensor in bytes. More... | |
virtual size_t | size () const =0 |
Total size of the tensor in bytes. More... | |
virtual Format | format () const =0 |
Image format of the tensor. More... | |
virtual DataLayout | data_layout () const =0 |
Data layout of the tensor. More... | |
virtual DataType | data_type () const =0 |
Data type of the tensor. More... | |
virtual int | num_channels () const =0 |
Number of channels of the tensor. More... | |
virtual int | num_elements () const =0 |
Number of elements of the tensor. More... | |
virtual PaddingSize | padding () const =0 |
Available padding around the tensor. More... | |
virtual QuantizationInfo | quantization_info () const =0 |
Quantization info in case of asymmetric quantized type. More... | |
Additional Inherited Members | |
Public Types inherited from SimpleTensor< uint8_t > | |
using | value_type = uint8_t |
Tensor value type. More... | |
using | Buffer = std::unique_ptr< value_type[]> |
Tensor buffer pointer type. More... | |
Related Functions inherited from SimpleTensor< uint8_t > | |
SimpleTensor< uint8_t > | convert_to_asymmetric (const SimpleTensor< float > &src, const QuantizationInfo &quantization_info) |
Convert float simple tensor into quantized using specified quantization information. More... | |
SimpleTensor< uint8_t > | convert_to_symmetric (const SimpleTensor< float > &src, const QuantizationInfo &quantization_info) |
Convert float simple tensor into quantized using specified quantization information. More... | |
Subclass of SimpleTensor using uint8_t as value type.
Access operations (except for operator[]) will be based on the data type to copy the right number of elements.
Definition at line 38 of file RawTensor.h.
RawTensor | ( | TensorShape | shape, |
Format | format | ||
) |
Create an uninitialised tensor of the given shape
and format
.
[in] | shape | Shape of the new raw tensor. |
[in] | format | Format of the new raw tensor. |
Definition at line 30 of file RawTensor.cpp.
References SimpleTensor< T >::element_size(), SimpleTensor< T >::num_channels(), and SimpleTensor< T >::num_elements().
RawTensor | ( | TensorShape | shape, |
DataType | data_type, | ||
int | num_channels = 1 |
||
) |
Create an uninitialised tensor of the given shape
and data
type.
[in] | shape | Shape of the new raw tensor. |
[in] | data_type | Data type of the new raw tensor. |
[in] | num_channels | (Optional) Number of channels (default = 1). |
Definition at line 36 of file RawTensor.cpp.
References SimpleTensor< T >::element_size(), SimpleTensor< T >::num_channels(), and SimpleTensor< T >::num_elements().
|
inline |
Conversion constructor from SimpleTensor.
The passed SimpleTensor will be destroyed after it has been converted to a RawTensor.
[in,out] | tensor | SimpleTensor to be converted to a RawTensor. |
Definition at line 64 of file RawTensor.h.
References tensor.
Create a deep copy of the given tensor
.
[in] | tensor | To be copied tensor. |
Definition at line 42 of file RawTensor.cpp.
References SimpleTensor< uint8_t >::element_size(), SimpleTensor< uint8_t >::num_channels(), SimpleTensor< uint8_t >::num_elements(), and tensor.
|
default |
Default destructor.
|
inline |
Conversion operator to SimpleTensor.
The current RawTensor must not be used after the conversion.
Definition at line 81 of file RawTensor.h.
|
overridevirtual |
Read only access to the specified element.
[in] | coord | Coordinates of the desired element. |
Implements IAccessor.
Definition at line 57 of file RawTensor.cpp.
References arm_compute::test::coord2index(), and SimpleTensor< uint8_t >::element_size().
|
overridevirtual |
Access to the specified element.
[in] | coord | Coordinates of the desired element. |
Implements IAccessor.
Definition at line 62 of file RawTensor.cpp.
References arm_compute::test::coord2index(), and SimpleTensor< uint8_t >::element_size().
Copy the given tensor
.
[in] | tensor | To be copied tensor. |
Definition at line 50 of file RawTensor.cpp.
References SimpleTensor< uint8_t >::swap, and tensor.