Mila 0.13.48
Deep Neural Network Library
Loading...
Searching...
No Matches
Dnn.Components.Dropout Module Reference

Exported Modules

module  Compute.OperationAttributes
module  Compute.MemoryResource
module  Compute.UnaryOperation
module  Compute.CpuMemoryResource
module  Compute.OperationBase
module  Dnn.Component
module  Serialization.ModelArchive
module  Dnn.ComponentType
module  Compute.DeviceContext
module  Compute.Device
module  Dnn.Tensor
module  Compute.DeviceId
module  Compute.OperationRegistry
module  Compute.Precision
module  Dnn.TensorTraits
module  Dnn.ITensor
module  Compute.DeviceType

Classes

class  Mila::Dnn::Dropout< TDeviceType, TInput, TOutput >
 Dropout regularization module for neural networks. More...
class  Mila::Dnn::DropoutConfig
 Configuration class for Dropout module. More...

Typedefs

using ComponentBase = Component<TDeviceType, TInput, TOutput>
 Alias for base Component type.
template<typename TInput = float, typename TOutput = TInput>
using Mila::Dnn::CpuDropout = Dropout<DeviceType::Cpu, TInput, TOutput>
 Type alias for CPU-based dropout module with customizable tensor types.
template<typename TInput = float, typename TOutput = TInput>
using Mila::Dnn::CudaDropout = Dropout<DeviceType::Cuda, TInput, TOutput>
 Type alias for CUDA-based dropout module with customizable tensor types.
using MR = typename DeviceTypeTraits<TDeviceType>::memory_resource
 Memory resource type used for tensors, selected based on device type.

Functions

 Dropout (const std::string &device_name, const DropoutConfig &config)
 Constructs a new Dropout module with a device name.
 Dropout (std::shared_ptr< DeviceContext > device_context, const DropoutConfig &config)
 Constructs a new Dropout module with a provided device context.
void backward (const Tensor< TInput, MR > &input, const Tensor< TOutput, MR > &output_grad, Tensor< TInput, MR > &input_grad)
 Performs the backward pass of the Dropout operation.
void createOperation ()
 Creates the appropriate Dropout operation based on the current device context.
void forward (const Tensor< TInput, MR > &input, Tensor< TOutput, MR > &output)
 Performs the forward pass of the Dropout operation.
void generateMask (Tensor< TOutput, MR > &mask, const std::vector< int64_t > &shape)
 Generates a new dropout mask for the given shape.
float getProbability () const
 Gets the dropout probability used by this module.
unsigned int getSeed () const
 Gets the current random seed.
const ComponentType getType () const override
 Get the component type identifier.
void load (ModelArchive &archive) override
 Deserializes the module state from a ZIP archive.
size_t parameterCount () const override
 Gets the number of trainable parameters in this module.
void save (ModelArchive &archive) const override
 Serializes the module state to a ZIP archive.
void setSeed (unsigned int seed)
 Sets the random seed for dropout mask generation.
std::string toString () const override
 Generates a string representation of this module's configuration.

Variables

DropoutConfig config_
 Configuration for the Dropout module.
std::shared_ptr< Tensor< TOutput, MR > > mask_ { nullptr }
 The binary mask tensor for element selection.
std::shared_ptr< UnaryOperation< TDeviceType, TInput, TOutput > > operation_ { nullptr }
 The operation that implements the dropout calculation.
std::vector< std::shared_ptr< Tensor< TOutput, MR > > > output_state_ = {}
 Collection of output state tensors for caching.
std::vector< std::shared_ptr< ITensor > > parameters_ = {}
 Collection of parameters for this module (empty for Dropout).
std::mt19937 rng_
 Random number generator for mask generation.
unsigned int seed_ { 0 }
 Random seed for reproducible dropout patterns.

Files

file  /__w/Mila/Mila/Mila/Src/Dnn/Components/Regularization/Dropout.ixx
 Implementation of Dropout regularization module for neural networks.
file  /__w/Mila/Mila/Mila/Src/Dnn/Components/Regularization/DropoutConfig.ixx
 Configuration interface for the Dropout regularization module in the Mila DNN framework.