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

#include <RmsNormLayer.h>

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

Public Member Functions

 RmsNormLayer ()
 
void configure (const IPortableTensor *input, const IPortableTensor *gamma, float epsilon, IPortableTensor *output)
 
void run () override
 
- Public Member Functions inherited from onert::exec::IFunction
virtual ~IFunction ()=default
 
virtual void prepare ()
 

Detailed Description

Definition at line 32 of file RmsNormLayer.h.

Constructor & Destructor Documentation

◆ RmsNormLayer()

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

Definition at line 35 of file RmsNormLayer.h.

35 : _input(nullptr), _output(nullptr), _gamma(nullptr), _epsilon(1e-06f)
36 {
37 // Nothing
38 }

Member Function Documentation

◆ configure()

void onert::backend::cpu::ops::RmsNormLayer::configure ( const IPortableTensor input,
const IPortableTensor gamma,
float  epsilon,
IPortableTensor output 
)

Definition at line 33 of file RmsNormLayer.cc.

35{
36 assert(input != nullptr);
37 assert(output != nullptr);
38
39 _input = input;
40 _output = output;
41 _gamma = gamma;
42 _epsilon = epsilon;
43}

◆ run()

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

Implements onert::exec::IFunction.

Definition at line 45 of file RmsNormLayer.cc.

46{
47 switch (_input->data_type())
48 {
49 case OperandType::FLOAT32:
51 param.epsilon = _epsilon;
52 nnfw::cker::RmsNorm(param, getShape(_input), getBuffer<float>(_input), getShape(_gamma),
53 getBuffer<float>(_gamma), getShape(_output), getBuffer<float>(_output));
54 break;
55
56 default:
57 throw std::runtime_error{"RmsNorm: Unsupported data type"};
58 }
59}
ir::DataType data_type() const override final
void RmsNorm(const RmsNormParams &params, const Shape &input_shape, const float *input_data, const Shape &gamma_shape, const float *gamma_data, const Shape &output_shape, float *output_data)
Definition RmsNorm.h:32
nnfw::cker::Shape getShape(const IPortableTensor *tensor)

References onert::backend::IPortableTensor::data_type(), nnfw::cker::RmsNormParams::epsilon, onert::backend::cpu::ops::getShape(), and nnfw::cker::RmsNorm().

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


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