Compute Library
 19.08
IGCTensor Class Referenceabstract

Interface for GLES Compute tensor. More...

#include <IGCTensor.h>

Collaboration diagram for IGCTensor:
[legend]

Public Member Functions

 IGCTensor ()
 Default constructor. More...
 
 IGCTensor (const IGCTensor &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
IGCTensoroperator= (const IGCTensor &)=delete
 Prevent instances of this class from being copy assigned (As this class contains pointers) More...
 
 IGCTensor (IGCTensor &&)=default
 Allow instances of this class to be moved. More...
 
IGCTensoroperator= (IGCTensor &&)=default
 Allow instances of this class to be moved. More...
 
virtual ~IGCTensor ()=default
 Virtual destructor. More...
 
void map (bool blocking=true)
 Map on an allocated buffer. More...
 
void unmap ()
 Unmap an allocated and mapped buffer. More...
 
void clear ()
 Clear the contents of the tensor synchronously. More...
 
uint8_t * buffer () const override
 Interface to be implemented by the child class to return a pointer to CPU memory. More...
 
virtual GLuint gc_buffer () const =0
 Interface to be implemented by the child class to return the tensor's gles compute buffer id. More...
 
bool needs_shifting () const
 Flag indicating whether the tensor has been left aligned by a kernel and therefore needs shifting. More...
 
void set_needs_shifting (bool needs_shifting)
 Set the flag indicating whether or not a tensor needs shifting. More...
 
- Public Member Functions inherited from ITensor
virtual ITensorInfoinfo () const =0
 Interface to be implemented by the child class to return the tensor's metadata. More...
 
virtual ITensorInfoinfo ()=0
 Interface to be implemented by the child class to return the tensor's metadata. More...
 
virtual ~ITensor ()=default
 Default virtual destructor. More...
 
uint8_t * ptr_to_element (const Coordinates &id) const
 Return a pointer to the element at the passed coordinates. More...
 
void copy_from (const ITensor &src)
 Copy the content of another tensor. More...
 
void print (std::ostream &s, IOFormatInfo io_fmt=IOFormatInfo()) const
 Print a tensor to a given stream using user defined formatting information. More...
 
bool is_used () const
 Flags if the tensor is used or not. More...
 
void mark_as_unused () const
 Marks a tensor as unused. More...
 

Detailed Description

Interface for GLES Compute tensor.

Definition at line 35 of file IGCTensor.h.

Constructor & Destructor Documentation

◆ IGCTensor() [1/3]

IGCTensor ( )

Default constructor.

Definition at line 28 of file IGCTensor.cpp.

29  : _mapping(nullptr), _needs_shifting(false)
30 {
31 }

◆ IGCTensor() [2/3]

IGCTensor ( const IGCTensor )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ IGCTensor() [3/3]

IGCTensor ( IGCTensor &&  )
default

Allow instances of this class to be moved.

◆ ~IGCTensor()

virtual ~IGCTensor ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ buffer()

uint8_t * buffer ( ) const
overridevirtual

Interface to be implemented by the child class to return a pointer to CPU memory.

Returns
A CPU pointer to the beginning of the image's allocation.

Implements ITensor.

Reimplemented in GCTensor.

Definition at line 51 of file IGCTensor.cpp.

52 {
53  return _mapping;
54 }

◆ clear()

void clear ( )

Clear the contents of the tensor synchronously.

Definition at line 44 of file IGCTensor.cpp.

45 {
46  this->map();
47  std::memset(static_cast<void *>(_mapping), 0, this->info()->total_size());
48  this->unmap();
49 }
void map(bool blocking=true)
Map on an allocated buffer.
Definition: IGCTensor.cpp:33
void unmap()
Unmap an allocated and mapped buffer.
Definition: IGCTensor.cpp:38
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.

References ITensor::info(), IGCTensor::map(), and IGCTensor::unmap().

◆ gc_buffer()

virtual GLuint gc_buffer ( ) const
pure virtual

Interface to be implemented by the child class to return the tensor's gles compute buffer id.

Returns
A SSBO buffer id.

Implemented in GCTensor.

◆ map()

void map ( bool  blocking = true)

Map on an allocated buffer.

Parameters
[in]blocking(Optional) If true, then the mapping will be ready to use by the time this method returns, else it is the caller's responsibility to flush the queue and wait for the mapping operation to have completed before using the returned mapping pointer.

Definition at line 33 of file IGCTensor.cpp.

34 {
35  _mapping = do_map(blocking);
36 }

Referenced by IGCTensor::clear(), GCTensor::map(), and arm_compute::test::print_tensor().

◆ needs_shifting()

bool needs_shifting ( ) const

Flag indicating whether the tensor has been left aligned by a kernel and therefore needs shifting.

Returns
True if the tensor is left aligned.

Definition at line 56 of file IGCTensor.cpp.

57 {
58  return _needs_shifting;
59 }

Referenced by GCTensorShiftKernel::run(), and IGCTensor::set_needs_shifting().

◆ operator=() [1/2]

IGCTensor& operator= ( const IGCTensor )
delete

Prevent instances of this class from being copy assigned (As this class contains pointers)

◆ operator=() [2/2]

IGCTensor& operator= ( IGCTensor &&  )
default

Allow instances of this class to be moved.

◆ set_needs_shifting()

void set_needs_shifting ( bool  needs_shifting)

Set the flag indicating whether or not a tensor needs shifting.

Parameters
[in]needs_shiftingIndicates if the tensor is left aligned or not.

Definition at line 61 of file IGCTensor.cpp.

62 {
63  _needs_shifting = needs_shifting;
64 }
bool needs_shifting() const
Flag indicating whether the tensor has been left aligned by a kernel and therefore needs shifting.
Definition: IGCTensor.cpp:56

References IGCTensor::needs_shifting().

Referenced by GCActivationLayerKernel::run(), GCDepthwiseConvolutionLayer3x3Kernel::run(), GCDepthConcatenateLayerKernel::run(), GCPoolingLayerKernel::run(), GCArithmeticAdditionKernel::run(), GCNormalizePlanarYUVLayerKernel::run(), and GCBatchNormalizationLayerKernel::run().

◆ unmap()

void unmap ( )

Unmap an allocated and mapped buffer.

Definition at line 38 of file IGCTensor.cpp.

39 {
40  do_unmap();
41  _mapping = nullptr;
42 }

Referenced by IGCTensor::clear(), arm_compute::test::print_tensor(), and GCTensor::unmap().


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