ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
onert::backend::cpu::ops::CompareLayer Class Reference

#include <CompareLayer.h>

Collaboration diagram for onert::backend::cpu::ops::CompareLayer:

Public Member Functions

 CompareLayer ()
 
void configure (const IPortableTensor *lhs, const IPortableTensor *rhs, const ir::operation::Comparison::ComparisonType op_type, IPortableTensor *output)
 
void run () override
 
- Public Member Functions inherited from onert::exec::IFunction
virtual ~IFunction ()=default
 
virtual void prepare ()
 

Detailed Description

Definition at line 28 of file CompareLayer.h.

Constructor & Destructor Documentation

◆ CompareLayer()

onert::backend::cpu::ops::CompareLayer::CompareLayer ( )

Definition at line 119 of file CompareLayer.cc.

120 : _lhs(nullptr), _rhs(nullptr), _output(nullptr),
122{
123 // DO NOTHING
124}

Member Function Documentation

◆ configure()

void onert::backend::cpu::ops::CompareLayer::configure ( const IPortableTensor lhs,
const IPortableTensor rhs,
const ir::operation::Comparison::ComparisonType  op_type,
IPortableTensor output 
)

Definition at line 126 of file CompareLayer.cc.

128{
129 _lhs = lhs;
130 _rhs = rhs;
131 _op_type = op_type;
132 _output = output;
133}

◆ run()

void onert::backend::cpu::ops::CompareLayer::run ( )
overridevirtual

Implements onert::exec::IFunction.

Definition at line 135 of file CompareLayer.cc.

136{
137 if (_lhs->data_type() == OperandType::FLOAT32)
138 {
139 compareScalar<float>(_lhs, _rhs, _output, _op_type);
140 }
141 else if (_lhs->data_type() == OperandType::INT32)
142 {
143 compareScalar<int32_t>(_lhs, _rhs, _output, _op_type);
144 }
145 else if (_lhs->data_type() == OperandType::INT64)
146 {
147 compareScalar<int64_t>(_lhs, _rhs, _output, _op_type);
148 }
149 else if (_lhs->data_type() == OperandType::BOOL8)
150 {
151 compareScalar<uint8_t>(_lhs, _rhs, _output, _op_type);
152 }
153 else if (_lhs->data_type() == OperandType::QUANT_UINT8_ASYMM)
154 {
155 compareQuant8<uint8_t>(_lhs, _rhs, _output, _op_type);
156 }
157 else
158 {
159 throw std::runtime_error{"Compare: unsupported data type"};
160 }
161}
ir::DataType data_type() const override final

References onert::backend::IPortableTensor::data_type().


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