MLask 1.0.0
A custom c++ deep learning library
Loading...
Searching...
No Matches
Public Member Functions | List of all members
mlask::LambdaActivationFunction Class Reference

ActivationFunction class. More...

#include <LambdaActivationFunction.hpp>

Inheritance diagram for mlask::LambdaActivationFunction:
Inheritance graph
[legend]
Collaboration diagram for mlask::LambdaActivationFunction:
Collaboration graph
[legend]

Public Member Functions

 LambdaActivationFunction (actfunc func, actfunc derv, std::size_t in=0)
 
vectorOut forward (vectorIn input) override
 Performs forward propagation.
 
vectorIn backward (vectorOut error) override
 Performs backward propagation.
 
void fit (float_t learning_rate) override
 No parameters to fit in an activation function, so this method does nothing.
 
- Public Member Functions inherited from mlask::Layer
std::size_t getIn () const
 
std::size_t getOut () const
 
virtual ~Layer ()=default
 
virtual bool tryConvertToONNX (onnx::GraphProto *graph, std::string input, std::string output) const
 Converts the layer to ONNX format. If the layer cannot be converted, it should return false.
 
virtual std::string str () const
 Returns a string representation of the layer.
 

Additional Inherited Members

- Protected Attributes inherited from mlask::Layer
std::size_t in_
 
std::size_t out_
 

Detailed Description

ActivationFunction class.

Class representing an activation function via two functions passed in constructor

This class is not convertible to ONNX and should preferably be used only for prototyping.

To create your own activation function, you can inherit from Layer abstract class and define the forward and backward methods.

Constructor & Destructor Documentation

◆ LambdaActivationFunction()

mlask::LambdaActivationFunction::LambdaActivationFunction ( actfunc  func,
actfunc  derv,
std::size_t  in = 0 
)
inline
Parameters
funcan activation function
dervis a derived form of func
insize of the input, in=0 means the input is not restricted to certain size

Member Function Documentation

◆ backward()

vectorIn mlask::LambdaActivationFunction::backward ( vectorOut  error)
overridevirtual

Performs backward propagation.

Parameters
errorthe error vector
Returns
the gradient vector

Implements mlask::Layer.

◆ fit()

void mlask::LambdaActivationFunction::fit ( float_t  learning_rate)
inlineoverridevirtual

No parameters to fit in an activation function, so this method does nothing.

Implements mlask::Layer.

◆ forward()

vectorOut mlask::LambdaActivationFunction::forward ( vectorIn  input)
overridevirtual

Performs forward propagation.

Parameters
inputthe input vector
Returns
the output vector

Implements mlask::Layer.


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