ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
onert::backend::train::ops::BackPropAccumulator Class Reference

#include <BackPropAccumulator.h>

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

Public Member Functions

 BackPropAccumulator (const IPortableTensor *disposable_tensor, IPortableTensor *back_prop_tensor)
 
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 ()
 

Detailed Description

Definition at line 28 of file BackPropAccumulator.h.

Constructor & Destructor Documentation

◆ BackPropAccumulator()

onert::backend::train::ops::BackPropAccumulator::BackPropAccumulator ( const IPortableTensor disposable_tensor,
IPortableTensor back_prop_tensor 
)

Definition at line 27 of file BackPropAccumulator.cc.

29 : _disposable_tensor{disposable_tensor}, _back_prop_tensor{back_prop_tensor}
30{
31 if (disposable_tensor->getShape() != back_prop_tensor->getShape())
32 throw std::runtime_error("train BackPropAccumulator: Unsupported shapes");
33
34 float output_activation_min = 0, output_activation_max = 0;
36 &output_activation_max);
37 _op_params.float_activation_max = output_activation_max;
38 _op_params.float_activation_min = output_activation_min;
39}
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::IPortableTensor::getShape(), and onert::ir::NONE.

Member Function Documentation

◆ backward()

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

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

Definition at line 46 of file BackPropAccumulator.cc.

47{
48 nnfw::cker::BinaryArithmeticOp<nnfw::cker::BinaryArithmeticOpType::ADD>(
49 _op_params, getShape(_disposable_tensor), getBuffer<float>(_disposable_tensor),
50 getShape(_back_prop_tensor), getBuffer<float>(_back_prop_tensor), getShape(_back_prop_tensor),
51 getBuffer<float>(_back_prop_tensor));
52}
nnfw::cker::Shape getShape(const IPortableTensor *tensor)
Get shape of tensor.

References onert::backend::train::ops::getShape().

◆ forward()

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

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

Definition at line 41 of file BackPropAccumulator.cc.

42{
43 // DO NOTHING
44}

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