ONE - On-device Neural Engine
Loading...
Searching...
No Matches
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 34 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 33 of file BackPropAccumulator.cc.

35 : _disposable_tensor{disposable_tensor}, _back_prop_tensor{back_prop_tensor}
36{
37 if (disposable_tensor->getShape() != back_prop_tensor->getShape())
38 throw std::runtime_error("train BackPropAccumulator: Unsupported shapes");
39
40 float output_activation_min = 0, output_activation_max = 0;
42 &output_activation_max);
43 _op_params.float_activation_max = output_activation_max;
44 _op_params.float_activation_min = output_activation_min;
45}
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 52 of file BackPropAccumulator.cc.

53{
54 nnfw::cker::BinaryArithmeticOp<nnfw::cker::BinaryArithmeticOpType::ADD>(
55 _op_params, getShape(_disposable_tensor), getBuffer<float>(_disposable_tensor),
56 getShape(_back_prop_tensor), getBuffer<float>(_back_prop_tensor), getShape(_back_prop_tensor),
57 getBuffer<float>(_back_prop_tensor));
58}
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 47 of file BackPropAccumulator.cc.

48{
49 // DO NOTHING
50}

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