Compute Library
 21.02
SimpleTensorAccessor< T > Class Template Reference

Accessor implementation for SimpleTensor objects. More...

#include <SimpleTensorAccessor.h>

Collaboration diagram for SimpleTensorAccessor< T >:
[legend]

Public Member Functions

 SimpleTensorAccessor (SimpleTensor< T > &tensor)
 Create an accessor for the given tensor. More...
 
 SimpleTensorAccessor (const SimpleTensorAccessor &)=delete
 Prevent instances of this class from being copy constructed. More...
 
SimpleTensorAccessoroperator= (const SimpleTensorAccessor &)=delete
 Prevent instances of this class from being copied. More...
 
 SimpleTensorAccessor (SimpleTensorAccessor &&)=default
 Allow instances of this class to be move constructed. More...
 
SimpleTensorAccessoroperator= (SimpleTensorAccessor &&)=default
 Allow instances of this class to be moved. More...
 
const void * data () const
 Get the tensor data. More...
 
void * data ()
 Get the tensor data. 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...
 
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...
 

Detailed Description

template<typename T>
class arm_compute::test::SimpleTensorAccessor< T >

Accessor implementation for SimpleTensor objects.

Definition at line 36 of file SimpleTensorAccessor.h.

Constructor & Destructor Documentation

◆ SimpleTensorAccessor() [1/3]

SimpleTensorAccessor ( SimpleTensor< T > &  tensor)
inline

Create an accessor for the given tensor.

Parameters
[in,out]tensorTo be accessed tensor.

Definition at line 84 of file SimpleTensorAccessor.h.

85  : _tensor{ tensor }
86 {
87 }

◆ SimpleTensorAccessor() [2/3]

SimpleTensorAccessor ( const SimpleTensorAccessor< T > &  )
delete

Prevent instances of this class from being copy constructed.

◆ SimpleTensorAccessor() [3/3]

Allow instances of this class to be move constructed.

Member Function Documentation

◆ data() [1/2]

const void * data ( ) const
inline

Get the tensor data.

Returns
a constant pointer to the tensor data.

Definition at line 150 of file SimpleTensorAccessor.h.

151 {
152  return _tensor.data();
153 }

◆ data() [2/2]

void * data ( )
inline

Get the tensor data.

Returns
a pointer to the tensor data.

Definition at line 156 of file SimpleTensorAccessor.h.

157 {
158  return _tensor.data();
159 }

◆ data_layout()

DataLayout data_layout ( ) const
inlineoverridevirtual

Data layout of the tensor.

Returns
the data layout of the tensor.

Implements IAccessor.

Definition at line 114 of file SimpleTensorAccessor.h.

115 {
116  return _tensor.data_layout();
117 }

◆ data_type()

DataType data_type ( ) const
inlineoverridevirtual

Data type of the tensor.

Returns
the data type of the tensor.

Implements IAccessor.

Definition at line 120 of file SimpleTensorAccessor.h.

121 {
122  return _tensor.data_type();
123 }

◆ element_size()

size_t element_size ( ) const
inlineoverridevirtual

Size of each element in the tensor in bytes.

Returns
the size of each element in the tensor in bytes.

Implements IAccessor.

Definition at line 96 of file SimpleTensorAccessor.h.

97 {
98  return _tensor.element_size();
99 }

◆ format()

Format format ( ) const
inlineoverridevirtual

Image format of the tensor.

Returns
the format of the tensor.

Implements IAccessor.

Definition at line 108 of file SimpleTensorAccessor.h.

109 {
110  return _tensor.format();
111 }

◆ num_channels()

int num_channels ( ) const
inlineoverridevirtual

Number of channels of the tensor.

Returns
the number of channels of the tensor.

Implements IAccessor.

Definition at line 126 of file SimpleTensorAccessor.h.

127 {
128  return _tensor.num_channels();
129 }

◆ num_elements()

int num_elements ( ) const
inlineoverridevirtual

Number of elements of the tensor.

Returns
the number of elements of the tensor.

Implements IAccessor.

Definition at line 132 of file SimpleTensorAccessor.h.

133 {
134  return _tensor.num_elements();
135 }

◆ operator()() [1/2]

const void * operator() ( const Coordinates coord) const
inlineoverridevirtual

Read only access to the specified element.

Parameters
[in]coordCoordinates of the desired element.
Returns
A pointer to the desired element.

Implements IAccessor.

Definition at line 162 of file SimpleTensorAccessor.h.

163 {
164  return _tensor(coord);
165 }

◆ operator()() [2/2]

void * operator() ( const Coordinates coord)
inlineoverridevirtual

Access to the specified element.

Parameters
[in]coordCoordinates of the desired element.
Returns
A pointer to the desired element.

Implements IAccessor.

Definition at line 168 of file SimpleTensorAccessor.h.

169 {
170  return _tensor(coord);
171 }

◆ operator=() [1/2]

SimpleTensorAccessor& operator= ( const SimpleTensorAccessor< T > &  )
delete

Prevent instances of this class from being copied.

◆ operator=() [2/2]

SimpleTensorAccessor& operator= ( SimpleTensorAccessor< T > &&  )
default

Allow instances of this class to be moved.

◆ padding()

PaddingSize padding ( ) const
inlineoverridevirtual

Available padding around the tensor.

Returns
the available padding around the tensor.

Implements IAccessor.

Definition at line 138 of file SimpleTensorAccessor.h.

139 {
140  return _tensor.padding();
141 }

◆ quantization_info()

QuantizationInfo quantization_info ( ) const
inlineoverridevirtual

Quantization info in case of asymmetric quantized type.

Returns

Implements IAccessor.

Definition at line 144 of file SimpleTensorAccessor.h.

145 {
146  return _tensor.quantization_info();
147 }

◆ shape()

TensorShape shape ( ) const
inlineoverridevirtual

Shape of the tensor.

Returns
the shape of the tensor.

Implements IAccessor.

Definition at line 90 of file SimpleTensorAccessor.h.

91 {
92  return _tensor.shape();
93 }

◆ size()

size_t size ( ) const
inlineoverridevirtual

Total size of the tensor in bytes.

Returns
the total size of the tensor in bytes.

Implements IAccessor.

Definition at line 102 of file SimpleTensorAccessor.h.

103 {
104  return _tensor.num_elements() * _tensor.element_size();
105 }

The documentation for this class was generated from the following file: