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

#include <SoftMaxLayer.h>

Collaboration diagram for onert::backend::train::ops::SoftMaxLayer:

Public Member Functions

 SoftMaxLayer ()
 
void configureBackward (IPortableTensor *back_prop_input, const IPortableTensor *back_prop_output)
 
void forward (bool training) override
 
void backward () override
 
- Public Member Functions inherited from onert::exec::train::ITrainableFunction
virtual ~ITrainableFunction ()=default
 
virtual std::optional< backend::train::LayerScopeTensorsregisterLayerScopeTensors ()
 
- Public Member Functions inherited from onert::backend::cpu::ops::SoftMaxLayer
 SoftMaxLayer ()
 
void softmaxFloat32 ()
 
template<typename T >
void softmaxQuant8 ()
 
void configure (const IPortableTensor *input, const float beta, IPortableTensor *output)
 
void run () override
 
- Public Member Functions inherited from onert::exec::IFunction
virtual ~IFunction ()=default
 
virtual void prepare ()
 

Additional Inherited Members

- Protected Attributes inherited from onert::backend::cpu::ops::SoftMaxLayer
const IPortableTensor_input
 
IPortableTensor_output
 

Detailed Description

Definition at line 34 of file SoftMaxLayer.h.

Constructor & Destructor Documentation

◆ SoftMaxLayer()

onert::backend::train::ops::SoftMaxLayer::SoftMaxLayer ( )

Definition at line 32 of file SoftMaxLayer.cc.

33 : cpu::ops::SoftMaxLayer(), _back_prop_input{nullptr}, _back_prop_output{nullptr}
34{
35 // DO NOTHING
36}

Member Function Documentation

◆ backward()

void onert::backend::train::ops::SoftMaxLayer::backward ( )
overridevirtual

Implements onert::exec::train::ITrainableFunction.

Definition at line 47 of file SoftMaxLayer.cc.

48{
49 assert(_back_prop_output->data_type() == _input->data_type());
50 switch (_back_prop_output->data_type())
51 {
52 case OperandType::FLOAT32:
53 {
55 getShape(_output), getBuffer<float>(_output), getShape(_back_prop_output),
56 getBuffer<float>(_back_prop_output), getShape(_back_prop_input),
57 getBuffer<float>(_back_prop_input));
58 break;
59 }
60 default:
61 throw std::runtime_error("train SoftMaxLayer: unsupported data type");
62 }
63}
ir::DataType data_type() const override final
void SoftMaxGrad(const Shape &output_shape, const float *output_data, const Shape &incoming_shape, const float *incoming_data, const Shape &grad_shape, float *grad_data)
Definition SoftMax.h:30
nnfw::cker::Shape getShape(const IPortableTensor *tensor)
Get shape of tensor.

References onert::backend::cpu::ops::SoftMaxLayer::_input, onert::backend::cpu::ops::SoftMaxLayer::_output, onert::backend::IPortableTensor::data_type(), onert::backend::train::ops::getShape(), and nnfw::cker::train::SoftMaxGrad().

◆ configureBackward()

void onert::backend::train::ops::SoftMaxLayer::configureBackward ( IPortableTensor back_prop_input,
const IPortableTensor back_prop_output 
)

Definition at line 38 of file SoftMaxLayer.cc.

40{
41 _back_prop_input = back_prop_input;
42 _back_prop_output = back_prop_output;
43}

◆ forward()

void onert::backend::train::ops::SoftMaxLayer::forward ( bool  training)
overridevirtual

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