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

#include <Maximum.h>

Collaboration diagram for luci_interpreter::kernels::Maximum:

Public Member Functions

 Maximum (const Tensor *input1, const Tensor *input2, Tensor *output)
 
const Tensorinput1 () const
 
const Tensorinput2 () 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 28 of file Maximum.h.

Constructor & Destructor Documentation

◆ Maximum()

luci_interpreter::kernels::Maximum::Maximum ( const Tensor input1,
const Tensor input2,
Tensor output 
)

Definition at line 29 of file Maximum.cpp.

30 : Kernel({input1, input2}, {output})
31{
32}
Kernel(std::vector< const Tensor * > inputs, std::vector< Tensor * > outputs)
Definition Kernel.h:31
const Tensor * input2() const
Definition Maximum.h:34
const Tensor * input1() const
Definition Maximum.h:33

References input1(), and input2().

Member Function Documentation

◆ configure()

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

Implements luci_interpreter::Kernel.

Definition at line 34 of file Maximum.cpp.

35{
36 LUCI_INTERPRETER_CHECK(input1()->element_type() == input2()->element_type())
37 LUCI_INTERPRETER_CHECK(input1()->element_type() == output()->element_type())
38 output()->resize(calculateShapeForBroadcast(input1()->shape(), input2()->shape()));
39}
#define LUCI_INTERPRETER_CHECK(cond)
Definition Utils.h:36
Shape calculateShapeForBroadcast(const Shape &input1_shape, const Shape &input2_shape)
Definition Utils.cpp:204

References luci_interpreter::kernels::calculateShapeForBroadcast(), input1(), input2(), LUCI_INTERPRETER_CHECK, output(), and luci_interpreter::Tensor::resize().

◆ execute()

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

Implements luci_interpreter::Kernel.

Definition at line 41 of file Maximum.cpp.

42{
43 switch (input1()->element_type())
44 {
45 case DataType::FLOAT32:
46 evalMaximum<float>();
47 break;
48 case DataType::U8:
49 evalMaximum<uint8_t>();
50 break;
51 default:
52 throw std::runtime_error("luci-intp Maximum Unsupported type.");
53 }
54}

References input1().

◆ input1()

const Tensor * luci_interpreter::kernels::Maximum::input1 ( ) const
inline

Definition at line 33 of file Maximum.h.

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

References luci_interpreter::Kernel::_inputs.

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

◆ input2()

const Tensor * luci_interpreter::kernels::Maximum::input2 ( ) const
inline

Definition at line 34 of file Maximum.h.

34{ return _inputs[1]; }

References luci_interpreter::Kernel::_inputs.

Referenced by configure(), and Maximum().

◆ output()

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

Definition at line 35 of file Maximum.h.

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

References luci_interpreter::Kernel::_outputs.

Referenced by configure().


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