21.02
|
CPP kernel to perform tensor TopKV operation. More...
#include <CPPTopKVKernel.h>
Public Member Functions | |
const char * | name () const override |
Name of the kernel. More... | |
CPPTopKVKernel () | |
Default constructor. More... | |
CPPTopKVKernel (const CPPTopKVKernel &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
CPPTopKVKernel & | operator= (const CPPTopKVKernel &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
CPPTopKVKernel (CPPTopKVKernel &&)=default | |
Allow instances of this class to be moved. More... | |
CPPTopKVKernel & | operator= (CPPTopKVKernel &&)=default |
Allow instances of this class to be moved. More... | |
~CPPTopKVKernel ()=default | |
Default destructor. More... | |
void | configure (const ITensor *predictions, const ITensor *targets, ITensor *output, const unsigned int k) |
Set the input and output of the kernel. More... | |
void | run (const Window &window, const ThreadInfo &info) override |
Execute the kernel on the passed window. More... | |
bool | is_parallelisable () const override |
Indicates whether or not the kernel is parallelisable. More... | |
Public Member Functions inherited from ICPPKernel | |
virtual | ~ICPPKernel ()=default |
Default destructor. More... | |
virtual void | run_nd (const Window &window, const ThreadInfo &info, const Window &thread_locator) |
legacy compatibility layer for implemantions which do not support thread_locator In these cases we simply narrow the interface down the legacy version More... | |
virtual void | run_op (ITensorPack &tensors, const Window &window, const ThreadInfo &info) |
Execute the kernel on the passed window. More... | |
Public Member Functions inherited from IKernel | |
IKernel () | |
Constructor. More... | |
virtual | ~IKernel ()=default |
Destructor. More... | |
virtual BorderSize | border_size () const |
The size of the border for that kernel. More... | |
const Window & | window () const |
The maximum window the kernel can be executed on. More... | |
Static Public Member Functions | |
static Status | validate (const ITensorInfo *predictions, const ITensorInfo *targets, ITensorInfo *output, const unsigned int k) |
Static function to check if given info will lead to a valid configuration of CPPTopKVKernel. More... | |
CPP kernel to perform tensor TopKV operation.
Definition at line 34 of file CPPTopKVKernel.h.
CPPTopKVKernel | ( | ) |
Default constructor.
Definition at line 94 of file CPPTopKVKernel.cpp.
Referenced by CPPTopKVKernel::name().
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
default |
Allow instances of this class to be moved.
|
default |
Default destructor.
Referenced by CPPTopKVKernel::name().
void configure | ( | const ITensor * | predictions, |
const ITensor * | targets, | ||
ITensor * | output, | ||
const unsigned int | k | ||
) |
Set the input and output of the kernel.
[in] | predictions | A batch_size x classes tensor. Data types supported: F16/S32/F32/QASYMM8/QASYMM8_SIGNED |
[in] | targets | A batch_size 1D tensor of class ids. Data types supported: U32 |
[out] | output | Computed precision at k as a bool 1D tensor. Data types supported: U8 |
[in] | k | Number of top elements to look at for computing precision. |
Definition at line 99 of file CPPTopKVKernel.cpp.
References ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, arm_compute::auto_init_if_empty(), ITensorInfo::dimension(), ITensor::info(), ITensorInfo::tensor_shape(), arm_compute::U8, and arm_compute::validate_arguments().
Referenced by CPPTopKVKernel::name().
|
overridevirtual |
Indicates whether or not the kernel is parallelisable.
If the kernel is parallelisable then the window returned by window() can be split into sub-windows which can then be run in parallel.
If the kernel is not parallelisable then only the window returned by window() can be passed to run()
Reimplemented from IKernel.
Definition at line 124 of file CPPTopKVKernel.cpp.
Referenced by CPPTopKVKernel::name().
|
inlineoverridevirtual |
Name of the kernel.
Implements ICPPKernel.
Definition at line 37 of file CPPTopKVKernel.h.
References CPPTopKVKernel::configure(), CPPTopKVKernel::CPPTopKVKernel(), arm_compute::test::validation::info, CPPTopKVKernel::is_parallelisable(), CPPTopKVKernel::operator=(), CPPTopKVKernel::run(), CPPTopKVKernel::validate(), IKernel::window(), and CPPTopKVKernel::~CPPTopKVKernel().
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
Referenced by CPPTopKVKernel::name().
|
default |
Allow instances of this class to be moved.
|
overridevirtual |
Execute the kernel on the passed window.
[in] | window | Region on which to execute the kernel. (Must be a region of the window returned by window()) |
[in] | info | Info about executing thread and CPU. |
Reimplemented from ICPPKernel.
Definition at line 129 of file CPPTopKVKernel.cpp.
References ARM_COMPUTE_ERROR, ARM_COMPUTE_UNUSED, ITensorInfo::data_type(), arm_compute::F16, arm_compute::F32, ITensor::info(), arm_compute::QASYMM8, arm_compute::QASYMM8_SIGNED, and arm_compute::S32.
Referenced by CPPTopKVKernel::name().
|
static |
Static function to check if given info will lead to a valid configuration of CPPTopKVKernel.
[in] | predictions | A batch_size x classes tensor info. Data types supported: F16/S32/F32/QASYMM8/QASYMM8_SIGNED |
[in] | targets | A batch_size 1D tensor info of class ids. Data types supported: U32 |
[in] | output | Computed precision at k as a bool 1D tensor info. Data types supported: U8 |
[in] | k | Number of top elements to look at for computing precision. |
Definition at line 118 of file CPPTopKVKernel.cpp.
References ARM_COMPUTE_RETURN_ON_ERROR, and arm_compute::validate_arguments().
Referenced by CPPTopKVKernel::name(), and CPPTopKV::validate().