Compute Library
18.05
|
Subclass of SimpleTensor using uint8_t as value type. More...
#include <RawTensor.h>
Public Member Functions | |
RawTensor (TensorShape shape, Format format, int fixed_point_position=0) | |
Create an uninitialised tensor of the given shape and format . More... | |
RawTensor (TensorShape shape, DataType data_type, int num_channels=1, int fixed_point_position=0) | |
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, int fixed_point_position=0) | |
Create an uninitialised tensor of the given shape and format . More... | |
SimpleTensor (TensorShape shape, DataType data_type, int num_channels=1, int fixed_point_position=0, 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... | |
int | fixed_point_position () const override |
Number of bits for the fractional part. More... | |
QuantizationInfo | quantization_info () const override |
Quantization info in case of asymmetric quantized type. 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... | |
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... | |
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, | ||
int | fixed_point_position = 0 |
||
) |
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. |
[in] | fixed_point_position | (Optional) Number of bits for the fractional part of the fixed point numbers |
Definition at line 30 of file RawTensor.cpp.
References SimpleTensor< T >::element_size(), SimpleTensor< T >::num_channels(), and SimpleTensor< T >::num_elements().
Referenced by RawTensor::operator SimpleTensor< T >().
RawTensor | ( | TensorShape | shape, |
DataType | data_type, | ||
int | num_channels = 1 , |
||
int | fixed_point_position = 0 |
||
) |
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). |
[in] | fixed_point_position | (Optional) Number of bits for the fractional part of the fixed point numbers (default = 0). |
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 66 of file RawTensor.h.
Create a deep copy of the given tensor
.
[in] | tensor | To be copied tensor. |
Definition at line 42 of file RawTensor.cpp.
References SimpleTensor< T >::data(), SimpleTensor< uint8_t >::element_size(), SimpleTensor< T >::format(), SimpleTensor< uint8_t >::num_channels(), and SimpleTensor< uint8_t >::num_elements().
|
default |
Default destructor.
Referenced by RawTensor::operator SimpleTensor< T >().
|
inline |
Conversion operator to SimpleTensor.
The current RawTensor must not be used after the conversion.
Definition at line 84 of file RawTensor.h.
References RawTensor::operator()(), RawTensor::operator=(), RawTensor::RawTensor(), and RawTensor::~RawTensor().
|
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().
Referenced by RawTensor::operator SimpleTensor< T >().
|
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.
Referenced by RawTensor::operator SimpleTensor< T >().