ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci_interpreter::kernels::Greater Class Reference

#include <Greater.h>

Collaboration diagram for luci_interpreter::kernels::Greater:

Public Member Functions

 Greater (const Tensor *x, const Tensor *y, Tensor *output)
 
const Tensorx () const
 
const Tensory () const
 
Tensoroutput () const
 
void configure () override
 
void execute () const override
 
- Public Member Functions inherited from luci_interpreter::Kernel
virtual ~Kernel ()=default
 
const std::vector< const Tensor * > & getInputTensors () const
 
const std::vector< Tensor * > & getOutputTensors () const
 

Additional Inherited Members

- Protected Member Functions inherited from luci_interpreter::Kernel
 Kernel (std::vector< const Tensor * > inputs, std::vector< Tensor * > outputs)
 
- Protected Attributes inherited from luci_interpreter::Kernel
const std::vector< const Tensor * > _inputs
 
const std::vector< Tensor * > _outputs
 

Detailed Description

Definition at line 27 of file Greater.h.

Constructor & Destructor Documentation

◆ Greater()

luci_interpreter::kernels::Greater::Greater ( const Tensor x,
const Tensor y,
Tensor output 
)

Definition at line 30 of file Greater.cpp.

30: Kernel({x, y}, {output}) {}
Kernel(std::vector< const Tensor * > inputs, std::vector< Tensor * > outputs)
Definition Kernel.h:31
const Tensor * y() const
Definition Greater.h:33
const Tensor * x() const
Definition Greater.h:32

References x(), and y().

Member Function Documentation

◆ configure()

void luci_interpreter::kernels::Greater::configure ( )
overridevirtual

Implements luci_interpreter::Kernel.

Definition at line 32 of file Greater.cpp.

33{
34 LUCI_INTERPRETER_CHECK(x()->element_type() == y()->element_type());
35 LUCI_INTERPRETER_CHECK(output()->element_type() == DataType::BOOL);
36
37 if (x()->element_type() == DataType::U8)
38 {
39 quantizeMultiplierSmallerThanOneExp(x()->scale(), &_x_multiplier, &_x_shift);
40 quantizeMultiplierSmallerThanOneExp(y()->scale(), &_y_multiplier, &_y_shift);
41 }
42 output()->resize(calculateShapeForBroadcast(x()->shape(), y()->shape()));
43}
void resize(const Shape &new_shape)
Definition Tensor.cpp:56
#define LUCI_INTERPRETER_CHECK(cond)
Definition Utils.h:36
Shape calculateShapeForBroadcast(const Shape &input1_shape, const Shape &input2_shape)
Definition Utils.cpp:204
void quantizeMultiplierSmallerThanOneExp(double double_multiplier, int32_t *quantized_multiplier, int *left_shift)
Definition Utils.cpp:193

References luci_interpreter::kernels::calculateShapeForBroadcast(), LUCI_INTERPRETER_CHECK, output(), luci_interpreter::kernels::quantizeMultiplierSmallerThanOneExp(), luci_interpreter::Tensor::resize(), x(), and y().

◆ execute()

void luci_interpreter::kernels::Greater::execute ( ) const
overridevirtual

Implements luci_interpreter::Kernel.

Definition at line 45 of file Greater.cpp.

46{
47 switch (x()->element_type())
48 {
49 case DataType::FLOAT32:
50 evalFloat();
51 break;
52 case DataType::S64:
53 evalInteger<int64_t>();
54 break;
55 case DataType::S32:
56 evalInteger<int32_t>();
57 break;
58 case DataType::U8:
59 evalQuantized();
60 break;
61 default:
62 throw std::runtime_error("luci-intp Greather Unsupported type.");
63 }
64}

References x().

◆ output()

Tensor * luci_interpreter::kernels::Greater::output ( ) const
inline

Definition at line 34 of file Greater.h.

34{ return _outputs[0]; }
const std::vector< Tensor * > _outputs
Definition Kernel.h:53

References luci_interpreter::Kernel::_outputs.

Referenced by configure().

◆ x()

const Tensor * luci_interpreter::kernels::Greater::x ( ) const
inline

Definition at line 32 of file Greater.h.

32{ return _inputs[0]; }
const std::vector< const Tensor * > _inputs
Definition Kernel.h:52

References luci_interpreter::Kernel::_inputs.

Referenced by configure(), execute(), and Greater().

◆ y()

const Tensor * luci_interpreter::kernels::Greater::y ( ) const
inline

Definition at line 33 of file Greater.h.

33{ return _inputs[1]; }

References luci_interpreter::Kernel::_inputs.

Referenced by configure(), and Greater().


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