21.02
|
Basic implementation of the OpenCL sub-tensor interface. More...
#include <CLSubTensor.h>
Public Member Functions | |
CLSubTensor () | |
Default Constructor. More... | |
CLSubTensor (ICLTensor *parent, const TensorShape &tensor_shape, const Coordinates &coords, bool extend_parent=false) | |
Constructor. More... | |
~CLSubTensor ()=default | |
Destructor: free the tensor's memory. More... | |
CLSubTensor (const CLSubTensor &)=delete | |
Restrict instances of this class to be copy constructed. More... | |
CLSubTensor & | operator= (const CLSubTensor &)=delete |
Restrict instances of this class to be copied. More... | |
CLSubTensor (CLSubTensor &&)=default | |
Allow instances of this class to be move constructed. More... | |
CLSubTensor & | operator= (CLSubTensor &&)=default |
Allow instances of this class to be moved. More... | |
void | map (bool blocking=true) |
Enqueue a map operation of the allocated buffer. More... | |
void | unmap () |
Enqueue an unmap operation of the allocated and mapped buffer. More... | |
ICLTensor * | parent () |
Return the parent tensor of the subtensor. More... | |
ITensorInfo * | info () const override |
Interface to be implemented by the child class to return the tensor's metadata. More... | |
ITensorInfo * | info () override |
Interface to be implemented by the child class to return the tensor's metadata. More... | |
const cl::Buffer & | cl_buffer () const override |
Interface to be implemented by the child class to return a reference to the OpenCL buffer containing the image's data. More... | |
CLQuantization | quantization () const override |
Interface to be implemented by the child class to return the wrapped quantization info data. More... | |
Public Member Functions inherited from ICLTensor | |
ICLTensor () | |
Default constructor. More... | |
ICLTensor (const ICLTensor &)=delete | |
Prevent instances of this class from being copy constructed. More... | |
ICLTensor & | operator= (const ICLTensor &)=delete |
Prevent instances of this class from being copied. More... | |
ICLTensor (ICLTensor &&)=default | |
Allow instances of this class to be move constructed. More... | |
ICLTensor & | operator= (ICLTensor &&)=default |
Allow instances of this class to be copied. More... | |
virtual | ~ICLTensor ()=default |
Default virtual destructor. More... | |
void | map (cl::CommandQueue &q, bool blocking=true) |
Enqueue a map operation of the allocated buffer on the given queue. More... | |
void | unmap (cl::CommandQueue &q) |
Enqueue an unmap operation of the allocated and mapped buffer on the given queue. More... | |
void | clear (cl::CommandQueue &q) |
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... | |
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... | |
Basic implementation of the OpenCL sub-tensor interface.
Definition at line 37 of file CLSubTensor.h.
CLSubTensor | ( | ) |
Default Constructor.
Definition at line 32 of file CLSubTensor.cpp.
CLSubTensor | ( | ICLTensor * | parent, |
const TensorShape & | tensor_shape, | ||
const Coordinates & | coords, | ||
bool | extend_parent = false |
||
) |
Constructor.
[in] | parent | Parent tensor |
[in] | tensor_shape | Shape of the subtensor |
[in] | coords | Coordinates of the first subtensor element inside the parent tensor. |
[in] | extend_parent | (Optional) Extend parent with subtensor shape if subtensor indexes out of bounds |
Definition at line 37 of file CLSubTensor.cpp.
References ARM_COMPUTE_ERROR_ON, ITensor::info(), and CLSubTensor::parent().
|
default |
Destructor: free the tensor's memory.
|
delete |
Restrict instances of this class to be copy constructed.
|
default |
Allow instances of this class to be move constructed.
|
overridevirtual |
Interface to be implemented by the child class to return a reference to the OpenCL buffer containing the image's data.
Implements ICLTensor.
Definition at line 55 of file CLSubTensor.cpp.
References ARM_COMPUTE_ERROR_ON, and ICLTensor::cl_buffer().
Referenced by CLSubTensor::unmap().
|
overridevirtual |
Interface to be implemented by the child class to return the tensor's metadata.
Implements ITensor.
Definition at line 45 of file CLSubTensor.cpp.
Referenced by CLSubTensor::unmap().
|
overridevirtual |
Interface to be implemented by the child class to return the tensor's metadata.
Implements ITensor.
Definition at line 50 of file CLSubTensor.cpp.
void map | ( | bool | blocking = true | ) |
Enqueue a map operation of the allocated buffer.
[in] | blocking | 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. |
Definition at line 71 of file CLSubTensor.cpp.
References CLScheduler::get(), and ICLTensor::map().
Referenced by CLSubTensorHandle::map().
|
delete |
Restrict instances of this class to be copied.
|
default |
Allow instances of this class to be moved.
ICLTensor * parent | ( | ) |
Return the parent tensor of the subtensor.
Definition at line 66 of file CLSubTensor.cpp.
Referenced by CLSubTensor::CLSubTensor().
|
overridevirtual |
Interface to be implemented by the child class to return the wrapped quantization info data.
Implements ICLTensor.
Definition at line 61 of file CLSubTensor.cpp.
References ICLTensor::quantization().
void unmap | ( | ) |
Enqueue an unmap operation of the allocated and mapped buffer.
Definition at line 76 of file CLSubTensor.cpp.
References ARM_COMPUTE_ERROR_ON, ICLTensor::buffer(), CLSubTensor::cl_buffer(), CLScheduler::get(), CLSubTensor::info(), and ICLTensor::unmap().
Referenced by CLSubTensorHandle::unmap().