Compute Library
 21.02
OperatorTensor Class Reference

Basic implementation of the tensor interface. More...

#include <OperatorTensor.h>

Collaboration diagram for OperatorTensor:
[legend]

Public Member Functions

 OperatorTensor (ITensorInfo *info, IMemory *memory)
 Constructor. More...
 
 ~OperatorTensor ()=default
 Destructor: free the tensor's memory. More...
 
 OperatorTensor (OperatorTensor &&)=default
 Allow instances of this class to be move constructed. More...
 
OperatorTensoroperator= (OperatorTensor &&)=default
 Allow instances of this class to be moved. More...
 
OperatorTensoroperator= (const OperatorTensor &)=delete
 Prevent instances of this class to be copy assigned. More...
 
 OperatorTensor (const OperatorTensor &)=delete
 Prevent instances of this class to be copy constructed. More...
 
arm_compute::ITensorInfoinfo () const override
 Interface to be implemented by the child class to return the tensor's metadata. More...
 
arm_compute::ITensorInfoinfo () override
 Interface to be implemented by the child class to return the tensor's metadata. More...
 
uint8_t * buffer () const override
 Interface to be implemented by the child class to return a pointer to CPU memory. More...
 
- Public Member Functions inherited from ITensor
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

Basic implementation of the tensor interface.

Definition at line 42 of file OperatorTensor.h.

Constructor & Destructor Documentation

◆ OperatorTensor() [1/3]

OperatorTensor ( ITensorInfo info,
IMemory memory 
)

Constructor.

Parameters
[in]infoPointer to the tensor info.
[in]memoryPointer to the memory info.

Definition at line 31 of file OperatorTensor.cpp.

32  : _info(info), _memory(memory), _mem_type(MemoryType::CPU)
33 {
34 }
arm_compute::ITensorInfo * info() const override
Interface to be implemented by the child class to return the tensor&#39;s metadata.

◆ ~OperatorTensor()

~OperatorTensor ( )
default

Destructor: free the tensor's memory.

◆ OperatorTensor() [2/3]

OperatorTensor ( OperatorTensor &&  )
default

Allow instances of this class to be move constructed.

◆ OperatorTensor() [3/3]

OperatorTensor ( const OperatorTensor )
delete

Prevent instances of this class to be copy constructed.

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.

Definition at line 46 of file OperatorTensor.cpp.

References ARM_COMPUTE_ERROR, arm_compute::experimental::CPU, and IMemory::region().

47 {
48  switch(_mem_type)
49  {
50  case MemoryType::CPU:
51  return (uint8_t *)dynamic_cast<MemoryRegion *>(_memory->region())->buffer();
52  default:
53  ARM_COMPUTE_ERROR("Memory type not supported.");
54  }
55 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
virtual IMemoryRegion * region()=0
Region accessor.
uint8_t * buffer() const override
Interface to be implemented by the child class to return a pointer to CPU memory. ...

◆ info() [1/2]

ITensorInfo * info ( ) const
overridevirtual

Interface to be implemented by the child class to return the tensor's metadata.

Returns
A pointer to the tensor's metadata.

Implements ITensor.

Definition at line 36 of file OperatorTensor.cpp.

37 {
38  return _info;
39 }

◆ info() [2/2]

ITensorInfo * info ( )
overridevirtual

Interface to be implemented by the child class to return the tensor's metadata.

Returns
A pointer to the tensor's metadata.

Implements ITensor.

Definition at line 41 of file OperatorTensor.cpp.

42 {
43  return _info;
44 }

◆ operator=() [1/2]

OperatorTensor& operator= ( OperatorTensor &&  )
default

Allow instances of this class to be moved.

◆ operator=() [2/2]

OperatorTensor& operator= ( const OperatorTensor )
delete

Prevent instances of this class to be copy assigned.


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