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

#include <Div.h>

Collaboration diagram for luci_interpreter::kernels::Div:

Public Member Functions

 Div (const Tensor *input1, const Tensor *input2, Tensor *output, const DivParams &params)
 
const Tensorinput1 () const
 
const Tensorinput2 () const
 
Tensoroutput () const
 
void configure () override
 
void execute () const override
 
- Public Member Functions inherited from luci_interpreter::KernelWithParams< DivParams >
const DivParamsparams () const
 
- 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::KernelWithParams< DivParams >
 KernelWithParams (std::vector< const Tensor * > inputs, std::vector< Tensor * > outputs, const DivParams &params)
 
- Protected Member Functions inherited from luci_interpreter::Kernel
 Kernel (std::vector< const Tensor * > inputs, std::vector< Tensor * > outputs)
 
- Protected Attributes inherited from luci_interpreter::KernelWithParams< DivParams >
const DivParams _params
 
- 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 Div.h.

Constructor & Destructor Documentation

◆ Div()

luci_interpreter::kernels::Div::Div ( const Tensor input1,
const Tensor input2,
Tensor output,
const DivParams params 
)

Definition at line 29 of file Div.cpp.

30 : KernelWithParams<DivParams>({input1, input2}, {output}, params)
31{
32}
Tensor * output() const
Definition Div.h:35
const Tensor * input2() const
Definition Div.h:34
const Tensor * input1() const
Definition Div.h:33

References input1(), and input2().

Member Function Documentation

◆ configure()

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

Implements luci_interpreter::Kernel.

Definition at line 34 of file Div.cpp.

35{
36 LUCI_INTERPRETER_CHECK(input1()->element_type() == input2()->element_type());
37 LUCI_INTERPRETER_CHECK(input1()->element_type() == output()->element_type());
38
39 output()->resize(calculateShapeForBroadcast(input1()->shape(), input2()->shape()));
40}
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

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

◆ execute()

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

Implements luci_interpreter::Kernel.

Definition at line 42 of file Div.cpp.

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

References input1().

◆ input1()

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

Definition at line 33 of file Div.h.

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

References luci_interpreter::Kernel::_inputs.

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

◆ input2()

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

Definition at line 34 of file Div.h.

34{ return _inputs[1]; }

References luci_interpreter::Kernel::_inputs.

Referenced by configure(), and Div().

◆ output()

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

Definition at line 35 of file Div.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: