Deep Learning Algorithm Implementations 1.0.0
C++ implementations of fundamental deep learning algorithms
Loading...
Searching...
No Matches
dl::layers::Dropout< T > Class Template Reference

Dropout layer for regularization. More...

#include <layers.hpp>

Inheritance diagram for dl::layers::Dropout< T >:
Collaboration diagram for dl::layers::Dropout< T >:

Public Member Functions

 Dropout (T p=0.5)
 Constructor.
 
Variable< T > forward (const Variable< T > &input) override
 Forward pass through the module.
 
std::vector< Variable< T > * > parameters () override
 Get all parameters of this module.
 
- Public Member Functions inherited from dl::layers::Module< T >
virtual ~Module ()=default
 
virtual void zero_grad ()
 Zero gradients of all parameters.
 
virtual void train (bool training=true)
 Set training mode.
 
virtual void eval ()
 Set evaluation mode.
 
bool is_training () const
 Check if module is in training mode.
 

Additional Inherited Members

- Protected Attributes inherited from dl::layers::Module< T >
bool training_ = true
 

Detailed Description

template<typename T>
class dl::layers::Dropout< T >

Dropout layer for regularization.

Definition at line 154 of file layers.hpp.

Constructor & Destructor Documentation

◆ Dropout()

template<typename T >
dl::layers::Dropout< T >::Dropout ( p = 0.5)
inlineexplicit

Constructor.

Parameters
pDropout probability (0.0 to 1.0)

Definition at line 160 of file layers.hpp.

Member Function Documentation

◆ forward()

template<typename T >
Variable< T > dl::layers::Dropout< T >::forward ( const Variable< T > &  input)
overridevirtual

Forward pass through the module.

Parameters
inputInput variable
Returns
Output variable

Implements dl::layers::Module< T >.

Definition at line 93 of file layers.cpp.

◆ parameters()

template<typename T >
std::vector< Variable< T > * > dl::layers::Dropout< T >::parameters ( )
inlineoverridevirtual

Get all parameters of this module.

Returns
Vector of parameter variables

Implements dl::layers::Module< T >.

Definition at line 163 of file layers.hpp.


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