ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert::backend::cpu::ops::PowLayer Class Reference

#include <PowLayer.h>

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

Public Member Functions

 PowLayer ()
 
void powFloat32 ()
 
void configure (const IPortableTensor *lhs, const IPortableTensor *rhs, const ir::Activation activation, IPortableTensor *output)
 
void run () override
 
- Public Member Functions inherited from onert::exec::IFunction
virtual ~IFunction ()=default
 
virtual void prepare ()
 

Detailed Description

Definition at line 34 of file PowLayer.h.

Constructor & Destructor Documentation

◆ PowLayer()

onert::backend::cpu::ops::PowLayer::PowLayer ( )
inline

Definition at line 37 of file PowLayer.h.

37 : _lhs(nullptr), _rhs(nullptr), _output(nullptr)
38 {
39 // DO NOTHING
40 }

Member Function Documentation

◆ configure()

void onert::backend::cpu::ops::PowLayer::configure ( const IPortableTensor lhs,
const IPortableTensor rhs,
const ir::Activation  activation,
IPortableTensor output 
)

Definition at line 51 of file PowLayer.cc.

53{
54 _lhs = lhs;
55 _rhs = rhs;
56 _activation = activation;
57 _output = output;
58}

◆ powFloat32()

void onert::backend::cpu::ops::PowLayer::powFloat32 ( )

Definition at line 31 of file PowLayer.cc.

32{
33 float output_activation_min = 0, output_activation_max = 0;
34 CalculateActivationRange(_activation, &output_activation_min, &output_activation_max);
36 op_params.float_activation_max = output_activation_max;
37 op_params.float_activation_min = output_activation_min;
38
39 if (!HaveSameShapes(_lhs, _rhs))
40 {
41 nnfw::cker::BroadcastBinaryArithmeticOp<nnfw::cker::BinaryArithmeticOpType::POW>(
42 op_params, getShape(_lhs), getBuffer<float>(_lhs), getShape(_rhs), getBuffer<float>(_rhs),
43 getShape(_output), getBuffer<float>(_output));
44 return;
45 }
46
47 nnfw::cker::powImpl(getShape(_lhs), getBuffer<float>(_lhs), getShape(_rhs),
48 getBuffer<float>(_rhs), getShape(_output), getBuffer<float>(_output));
49}
void powImpl(const Shape &input1_shape, const T *input1_data, const Shape &input2_shape, const T *input2_data, const Shape &output_shape, T *output_data)
Definition Pow.h:31
nnfw::cker::Shape getShape(const IPortableTensor *tensor)
bool HaveSameShapes(const IPortableTensor *input1, const IPortableTensor *input2)
void CalculateActivationRange(ir::Activation activation, T *activation_min, T *activation_max)

References onert::util::CalculateActivationRange(), nnfw::cker::BinaryArithmeticOpParam::float_activation_max, nnfw::cker::BinaryArithmeticOpParam::float_activation_min, onert::backend::cpu::ops::getShape(), onert::backend::cpu::ops::HaveSameShapes(), and nnfw::cker::powImpl().

Referenced by run().

◆ run()

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

Implements onert::exec::IFunction.

Definition at line 60 of file PowLayer.cc.

61{
62 if (_output->data_type() == OperandType::FLOAT32)
63 powFloat32();
64 else
65 throw std::runtime_error{"Pow: unsupportted data type"};
66}
ir::DataType data_type() const override final

References onert::backend::IPortableTensor::data_type(), and powFloat32().

Referenced by package.infer.session::inference().


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