MLask 1.0.0
A custom c++ deep learning library
Loading...
Searching...
No Matches
Public Member Functions | List of all members
mlask::FullyConnectedLayer< in, out > Class Template Reference

Class representing fully connected layer. More...

#include <FullyConnectedLayer.hpp>

Inheritance diagram for mlask::FullyConnectedLayer< in, out >:
Inheritance graph
[legend]
Collaboration diagram for mlask::FullyConnectedLayer< in, out >:
Collaboration graph
[legend]

Public Member Functions

 FullyConnectedLayer ()
 A constructor for fully connected layer, initializes weights and biases with random values, and changes with zeros.
 
vectorOut forward (vectorIn input) override
 A function defining moving foraward in neural network.
 
vectorIn backward (vectorOut error) override
 A backtrack for backpropagation algorithm.
 
void fit (float_t learning_rate) override
 A function that updates weights and biases.
 
bool tryConvertToONNX (onnx::GraphProto *graph, std::string input, std::string output) const override
 A function that tries to convert the layer to ONNX format, returns true if successful, false otherwise.
 
std::string str () const override
 Returns a string representation of the layer.
 
Eigen::Matrix< float_t, out, inweights ()
 
Eigen::Matrix< float_t, in, 1 > bias ()
 
- Public Member Functions inherited from mlask::Layer
std::size_t getIn () const
 
std::size_t getOut () const
 
virtual ~Layer ()=default
 

Additional Inherited Members

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

Detailed Description

template<std::size_t in, std::size_t out>
class mlask::FullyConnectedLayer< in, out >

Class representing fully connected layer.

Meaning a layer with in number of neurons as an input and out number of neurons as an output,

where all the neurons are connected with each other.

Template Parameters
inThe number of neurons in the input
outThe number of neurons in the output

Constructor & Destructor Documentation

◆ FullyConnectedLayer()

template<std::size_t in, std::size_t out>
mlask::FullyConnectedLayer< in, out >::FullyConnectedLayer ( )
inline

A constructor for fully connected layer, initializes weights and biases with random values, and changes with zeros.

Member Function Documentation

◆ backward()

template<std::size_t in, std::size_t out>
vectorIn mlask::FullyConnectedLayer< in, out >::backward ( vectorOut  error)
overridevirtual

A backtrack for backpropagation algorithm.

Implements mlask::Layer.

◆ bias()

template<std::size_t in, std::size_t out>
Eigen::Matrix< float_t, in, 1 > mlask::FullyConnectedLayer< in, out >::bias ( )
inline

◆ fit()

template<std::size_t in, std::size_t out>
void mlask::FullyConnectedLayer< in, out >::fit ( float_t  learning_rate)
overridevirtual

A function that updates weights and biases.

Implements mlask::Layer.

◆ forward()

template<std::size_t in, std::size_t out>
vectorOut mlask::FullyConnectedLayer< in, out >::forward ( vectorIn  input)
overridevirtual

A function defining moving foraward in neural network.

Implements mlask::Layer.

◆ str()

template<std::size_t in, std::size_t out>
std::string mlask::FullyConnectedLayer< in, out >::str ( ) const
overridevirtual

Returns a string representation of the layer.

Reimplemented from mlask::Layer.

◆ tryConvertToONNX()

template<std::size_t in, std::size_t out>
bool mlask::FullyConnectedLayer< in, out >::tryConvertToONNX ( onnx::GraphProto *  graph,
std::string  input,
std::string  output 
) const
overridevirtual

A function that tries to convert the layer to ONNX format, returns true if successful, false otherwise.

Parameters
graphA pointer to the ONNX graph to which the layer should be added
inputThe name of the input tensor for this layer in the ONNX graph
outputThe name of the output tensor for this layer in the ONNX graph

Reimplemented from mlask::Layer.

◆ weights()

template<std::size_t in, std::size_t out>
Eigen::Matrix< float_t, out, in > mlask::FullyConnectedLayer< in, out >::weights ( )
inline

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