Compute Library
 22.05
IContext Class Referenceabstract

Context interface. More...

#include <IContext.h>

Collaboration diagram for IContext:
[legend]

Public Member Functions

 IContext (Target target)
 
virtual ~IContext ()
 Virtual Destructor. More...
 
Target type () const
 Target type accessor. More...
 
void inc_ref () const
 Increment context refcount. More...
 
void dec_ref () const
 Decrement context refcount. More...
 
int refcount () const
 Reference counter accessor. More...
 
bool is_valid () const
 Checks if an object is valid. More...
 
virtual ITensorV2create_tensor (const AclTensorDescriptor &desc, bool allocate)=0
 Create a tensor object. More...
 
virtual IQueuecreate_queue (const AclQueueOptions *options)=0
 Create a queue object. More...
 
virtual std::tuple< IOperator *, StatusCodecreate_activation (const AclTensorDescriptor &src, const AclTensorDescriptor &dst, const AclActivationDescriptor &act, bool is_validate)=0
 

Additional Inherited Members

- Data Fields inherited from AclContext_
arm_compute::detail::Header header { arm_compute::detail::ObjectType::Context, nullptr }
 

Detailed Description

Context interface.

Definition at line 50 of file IContext.h.

Constructor & Destructor Documentation

◆ IContext()

IContext ( Target  target)
inline

Definition at line 53 of file IContext.h.

54  : AclContext_(), _target(target), _refcount(0)
55  {
56  }

◆ ~IContext()

virtual ~IContext ( )
inlinevirtual

Virtual Destructor.

Definition at line 58 of file IContext.h.

References AclContext_::header, and Header::type.

59  {
61  };
arm_compute::detail::Header header
Definition: IContext.h:35

Member Function Documentation

◆ create_activation()

virtual std::tuple<IOperator *, StatusCode> create_activation ( const AclTensorDescriptor src,
const AclTensorDescriptor dst,
const AclActivationDescriptor act,
bool  is_validate 
)
pure virtual

Implemented in ClContext, and CpuContext.

◆ create_queue()

virtual IQueue* create_queue ( const AclQueueOptions options)
pure virtual

Create a queue object.

Parameters
[in]optionsQueue options to be used
Returns
A pointer to the created queue object

Implemented in ClContext, and CpuContext.

◆ create_tensor()

virtual ITensorV2* create_tensor ( const AclTensorDescriptor desc,
bool  allocate 
)
pure virtual

Create a tensor object.

Parameters
[in]descDescriptor to use
[in]allocateFlag to allocate tensor
Returns
A pointer to the created tensor object

Implemented in ClContext, and CpuContext.

Referenced by AclCreateTensor().

◆ dec_ref()

void dec_ref ( ) const
inline

Decrement context refcount.

Definition at line 76 of file IContext.h.

Referenced by IQueue::~IQueue(), ITensorV2::~ITensorV2(), and TensorPack::~TensorPack().

77  {
78  --_refcount;
79  }

◆ inc_ref()

void inc_ref ( ) const
inline

Increment context refcount.

Definition at line 71 of file IContext.h.

Referenced by IQueue::IQueue(), ITensorV2::ITensorV2(), and TensorPack::TensorPack().

72  {
73  ++_refcount;
74  }

◆ is_valid()

bool is_valid ( ) const
inline

Checks if an object is valid.

Returns
True if sucessful otherwise false

Definition at line 92 of file IContext.h.

References arm_compute::test::create_tensor(), arm_compute::test::validation::dst, AclContext_::header, arm_compute::test::validation::src, and Header::type.

Referenced by arm_compute::detail::validate_internal_context().

93  {
95  }
arm_compute::detail::Header header
Definition: IContext.h:35

◆ refcount()

int refcount ( ) const
inline

Reference counter accessor.

Returns
The number of references pointing to this object

Definition at line 84 of file IContext.h.

Referenced by AclDestroyContext(), AclSetClContext(), and ClContext::set_cl_ctx().

85  {
86  return _refcount;
87  }

◆ type()

Target type ( ) const
inline

Target type accessor.

Returns
Target that the context is associated with

Definition at line 66 of file IContext.h.

Referenced by AclGetClContext(), AclGetClDevice(), AclGetClMem(), AclGetClQueue(), AclSetClContext(), AclSetClQueue(), ClTensor::ClTensor(), and CpuTensor::CpuTensor().

67  {
68  return _target;
69  }

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