Compute Library
 22.11
CpuComparisonKernel Class Reference

#include <CpuElementwiseKernel.h>

Collaboration diagram for CpuComparisonKernel:
[legend]

Public Member Functions

 CpuComparisonKernel ()=default
 
void configure (ComparisonOperation op, const ITensorInfo *src0, const ITensorInfo *src1, ITensorInfo *dst)
 Configure kernel. More...
 
- Public Member Functions inherited from CpuElementwiseKernel< CpuComparisonKernel >
 CpuElementwiseKernel ()=default
 
 ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE (CpuElementwiseKernel)
 
void run_op (ITensorPack &tensors, const Window &window, const ThreadInfo &info) override
 Execute the kernel on the passed window. More...
 
const char * name () const override
 Name of the kernel. More...
 
- Public Member Functions inherited from ICPPKernel
virtual ~ICPPKernel ()=default
 Default destructor. More...
 
virtual void run (const Window &window, const ThreadInfo &info)
 Execute the kernel on the passed window. 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 size_t get_mws (const CPUInfo &platform, size_t thread_count) const
 Return minimum workload size of the relevant kernel. More...
 
- Public Member Functions inherited from IKernel
 IKernel ()
 Constructor. More...
 
virtual ~IKernel ()=default
 Destructor. More...
 
virtual bool is_parallelisable () const
 Indicates whether or not the kernel is parallelisable. More...
 
virtual BorderSize border_size () const
 The size of the border for that kernel. More...
 
const Windowwindow () const
 The maximum window the kernel can be executed on. More...
 
bool is_window_configured () const
 Function to check if the embedded window of this kernel has been configured. More...
 

Static Public Member Functions

static Status validate (ComparisonOperation op, const ITensorInfo *src0, const ITensorInfo *src1, const ITensorInfo *dst)
 Static function to check if given info will lead to a valid configuration. More...
 
static const std::vector< CpuElementwiseKernel< CpuComparisonKernel >::ElementwiseKernel > & get_available_kernels ()
 
- Static Public Member Functions inherited from ICpuKernel< CpuComparisonKernel >
static const auto * get_implementation (const SelectorType &selector, KernelSelectionType selection_type=KernelSelectionType::Supported)
 Micro-kernel selector. More...
 

Additional Inherited Members

- Public Types inherited from CpuElementwiseKernel< CpuComparisonKernel >
using ElementwiseFunction = void(const ITensor *, const ITensor *, ITensor *, const Window &)
 
- Static Public Attributes inherited from ICPPKernel
static constexpr size_t default_mws = 1
 

Detailed Description

Definition at line 175 of file CpuElementwiseKernel.h.

Constructor & Destructor Documentation

◆ CpuComparisonKernel()

CpuComparisonKernel ( )
default

Member Function Documentation

◆ configure()

void configure ( ComparisonOperation  op,
const ITensorInfo src0,
const ITensorInfo src1,
ITensorInfo dst 
)

Configure kernel.

Comparison operators (equal, not equal, less than, greater than, less than or equal, greater than or equal)

Parameters
[in]opComparison operation to be executed.
[in]src0First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32.
[in]src1Second tensor input info. Data types supported: Same as src0.
[out]dstOutput tensor info. Data types supported: U8.

Definition at line 448 of file CpuElementwiseKernel.cpp.

References ARM_COMPUTE_ERROR_THROW_ON, ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, arm_compute::F16, arm_compute::F32, arm_compute::QASYMM8, arm_compute::QASYMM8_SIGNED, arm_compute::S16, arm_compute::S32, ITensorInfo::total_size(), and arm_compute::U8.

449 {
450  ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(*src0, *src1, *dst));
451  _op = op;
452  CpuComparisonKernel::configure_common(src0, src1, dst);
453 }
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:455

◆ get_available_kernels()

const std::vector< CpuElementwiseKernel< CpuComparisonKernel >::ElementwiseKernel > & get_available_kernels ( )
static

Definition at line 277 of file CpuElementwiseKernel.cpp.

References ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED, ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES, ARM_COMPUTE_RETURN_ERROR_ON_MSG, arm_compute::auto_init_if_empty(), TensorShape::broadcast_shape(), ITensorInfo::data_type(), arm_compute::test::validation::dst, arm_compute::mlgo::parser::end(), CPUInfo::get(), ICpuKernel< CpuComparisonKernel >::get_implementation(), ICpuKernel< CpuArithmeticKernel >::get_implementation(), CPUInfo::get_isa(), arm_compute::detail::have_different_dimensions(), ITensorInfo::is_dynamic(), ITensorInfo::tensor_shape(), TensorShape::total_size(), and ITensorInfo::total_size().

278 {
279  static std::vector<CpuElementwiseKernel<CpuComparisonKernel>::ElementwiseKernel> available_kernels;
280  std::move(available_kernels_comperison<ComparisonOperation::Equal>.begin(), available_kernels_comperison<ComparisonOperation::Equal>.end(), std::back_inserter(available_kernels));
281  std::move(available_kernels_comperison<ComparisonOperation::NotEqual>.begin(), available_kernels_comperison<ComparisonOperation::NotEqual>.end(), std::back_inserter(available_kernels));
282  std::move(available_kernels_comperison<ComparisonOperation::Greater>.begin(), available_kernels_comperison<ComparisonOperation::Greater>.end(), std::back_inserter(available_kernels));
283  std::move(available_kernels_comperison<ComparisonOperation::GreaterEqual>.begin(), available_kernels_comperison<ComparisonOperation::GreaterEqual>.end(), std::back_inserter(available_kernels));
284  std::move(available_kernels_comperison<ComparisonOperation::Less>.begin(), available_kernels_comperison<ComparisonOperation::Less>.end(), std::back_inserter(available_kernels));
285  std::move(available_kernels_comperison<ComparisonOperation::LessEqual>.begin(), available_kernels_comperison<ComparisonOperation::LessEqual>.end(), std::back_inserter(available_kernels));
286 
287  return available_kernels;
288 }
void end(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:290

◆ validate()

Status validate ( ComparisonOperation  op,
const ITensorInfo src0,
const ITensorInfo src1,
const ITensorInfo dst 
)
static

Static function to check if given info will lead to a valid configuration.

Similar to CpuComparisonKernel::configure()

Returns
a status

Definition at line 466 of file CpuElementwiseKernel.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR, ARM_COMPUTE_RETURN_ON_ERROR, and ARM_COMPUTE_UNUSED.

Referenced by CpuElementwiseComparison::validate(), and CpuElementwiseComparisonStatic< op >::validate().

467 {
468  ARM_COMPUTE_UNUSED(op);
470  ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(*src0, *src1, *dst));
471  return Status{};
472 }
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
Definition: Validate.h:159
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152

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