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

#include <Pow.h>

Collaboration diagram for luci_interpreter::kernels::Pow:

Public Member Functions

 Pow (const Tensor *input1, const Tensor *input2, Tensor *output)
 
const Tensorinput1 () const
 
const Tensorinput2 () const
 
Tensoroutput () const
 
void configure () override
 
void execute () const override
 
 Pow (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 27 of file Pow.h.

Constructor & Destructor Documentation

◆ Pow() [1/2]

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

Definition at line 29 of file Pow.cpp.

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

References input1(), and input2().

◆ Pow() [2/2]

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

Member Function Documentation

◆ configure() [1/2]

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

Implements luci_interpreter::Kernel.

Definition at line 34 of file Pow.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().

◆ configure() [2/2]

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

◆ execute() [1/2]

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

Implements luci_interpreter::Kernel.

Definition at line 42 of file Pow.cpp.

43{
44 switch (input1()->element_type())
45 {
46 case DataType::FLOAT32:
47 eval<float>();
48 break;
49 case DataType::S32:
50 eval<int32_t>();
51 break;
52 default:
53 throw std::runtime_error("luci-intp Pow Unsupported type.");
54 }
55}

References input1().

◆ execute() [2/2]

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

◆ input1() [1/2]

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

Definition at line 32 of file Pow.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 Pow().

◆ input1() [2/2]

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

Definition at line 32 of file Pow.h.

32{ return _inputs[0]; }

References luci_interpreter::Kernel::_inputs.

◆ input2() [1/2]

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

Definition at line 33 of file Pow.h.

33{ return _inputs[1]; }

References luci_interpreter::Kernel::_inputs.

Referenced by configure(), and Pow().

◆ input2() [2/2]

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

Definition at line 33 of file Pow.h.

33{ return _inputs[1]; }

References luci_interpreter::Kernel::_inputs.

◆ output() [1/2]

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

Definition at line 34 of file Pow.h.

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

References luci_interpreter::Kernel::_outputs.

Referenced by configure().

◆ output() [2/2]

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

Definition at line 34 of file Pow.h.

34{ return _outputs[0]; }

References luci_interpreter::Kernel::_outputs.


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