My Project
Public Member Functions | List of all members
cpu_mlp::DenseLayer< In, Out, Activation > Class Template Reference

Fully-connected layer with activation. More...

#include <layer.hpp>

Inheritance diagram for cpu_mlp::DenseLayer< In, Out, Activation >:
Inheritance graph
[legend]
Collaboration diagram for cpu_mlp::DenseLayer< In, Out, Activation >:
Collaboration graph
[legend]

Public Member Functions

 DenseLayer ()
 
int getInSize () const override
 Input dimension. More...
 
int getOutSize () const override
 Output dimension. More...
 
int getParamsSize () const override
 Parameter count. More...
 
void bind (double *params, double *grads) override
 Bind parameter and gradient storage. More...
 
void forward (const Eigen::MatrixXd &input, Eigen::MatrixXd &output) override
 Forward pass for a batch. More...
 
void backward (const Eigen::MatrixXd &next_grad, Eigen::MatrixXd *prev_grad) override
 Backward pass for a batch. More...
 
double getInitStdDev () const override
 Initialization scale. More...
 
- Public Member Functions inherited from cpu_mlp::Layer
virtual ~Layer ()=default
 

Detailed Description

template<int In, int Out, typename Activation = Linear>
class cpu_mlp::DenseLayer< In, Out, Activation >

Fully-connected layer with activation.

Constructor & Destructor Documentation

◆ DenseLayer()

template<int In, int Out, typename Activation = Linear>
cpu_mlp::DenseLayer< In, Out, Activation >::DenseLayer ( )
inline

Member Function Documentation

◆ backward()

template<int In, int Out, typename Activation = Linear>
void cpu_mlp::DenseLayer< In, Out, Activation >::backward ( const Eigen::MatrixXd &  next_grad,
Eigen::MatrixXd *  prev_grad 
)
inlineoverridevirtual

Backward pass for a batch.

Implements cpu_mlp::Layer.

◆ bind()

template<int In, int Out, typename Activation = Linear>
void cpu_mlp::DenseLayer< In, Out, Activation >::bind ( double *  params,
double *  grads 
)
inlineoverridevirtual

Bind parameter and gradient storage.

Implements cpu_mlp::Layer.

◆ forward()

template<int In, int Out, typename Activation = Linear>
void cpu_mlp::DenseLayer< In, Out, Activation >::forward ( const Eigen::MatrixXd &  input,
Eigen::MatrixXd &  output 
)
inlineoverridevirtual

Forward pass for a batch.

Implements cpu_mlp::Layer.

◆ getInitStdDev()

template<int In, int Out, typename Activation = Linear>
double cpu_mlp::DenseLayer< In, Out, Activation >::getInitStdDev ( ) const
inlineoverridevirtual

Initialization scale.

Implements cpu_mlp::Layer.

◆ getInSize()

template<int In, int Out, typename Activation = Linear>
int cpu_mlp::DenseLayer< In, Out, Activation >::getInSize ( ) const
inlineoverridevirtual

Input dimension.

Implements cpu_mlp::Layer.

◆ getOutSize()

template<int In, int Out, typename Activation = Linear>
int cpu_mlp::DenseLayer< In, Out, Activation >::getOutSize ( ) const
inlineoverridevirtual

Output dimension.

Implements cpu_mlp::Layer.

◆ getParamsSize()

template<int In, int Out, typename Activation = Linear>
int cpu_mlp::DenseLayer< In, Out, Activation >::getParamsSize ( ) const
inlineoverridevirtual

Parameter count.

Implements cpu_mlp::Layer.


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