Mila
Deep Neural Network Library
Loading...
Searching...
No Matches
Dnn.Modules.Softmax Module Reference

Exported Modules

module  Compute.UnaryOperation
 
module  Dnn.TensorHelpers
 
module  Compute.OperationBase
 
module  Compute.CpuMemoryResource
 
module  Compute.MemoryResource
 
module  Compute.DeviceType
 
module  Compute.OperationAttributes
 
module  Dnn.Module
 
module  Dnn.Tensor
 
module  Dnn.TensorTraits
 
module  Compute.Precision
 
module  Compute.OperationRegistry
 
module  Compute.CudaMemoryResource
 
module  Compute.DeviceContext
 
module  Compute.ComputeDevice
 
module  Serialization.ModelArchive
 

Classes

class  Mila::Dnn::Softmax< TDeviceType, TInput, TOutput >
 Softmax module for neural networks. More...
 
class  Mila::Dnn::SoftmaxConfig
 Configuration class for Softmax module. More...
 

Typedefs

template<typename TInput = float, typename TOutput = TInput>
using Mila::Dnn::CpuSoftmax = Softmax< DeviceType::Cpu, TInput, TOutput >
 Type alias for CPU-based softmax module with customizable tensor types.
 
template<typename TInput = float, typename TOutput = TInput>
using Mila::Dnn::CudaSoftmax = Softmax< DeviceType::Cuda, TInput, TOutput >
 Type alias for CUDA-based softmax module with customizable tensor types.
 
using ModuleBase = Module< TDeviceType, TInput, TOutput >
 Alias for base module type.
 
using MR = std::conditional_t< TDeviceType==DeviceType::Cuda, CudaMemoryResource, CpuMemoryResource >
 Memory resource type used for tensors, selected based on device type.
 

Functions

 Softmax (const std::string &device_name, const SoftmaxConfig &config)
 Constructs a new Softmax module with a device name.
 
 Softmax (std::shared_ptr< DeviceContext > device_context, const SoftmaxConfig &config)
 Constructs a new Softmax 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 Softmax operation.
 
void createOperation ()
 Creates the appropriate softmax operation for the current device.
 
void forward (const Tensor< TInput, MR > &input, Tensor< TOutput, MR > &output)
 Performs the forward pass of the softmax operation.
 
int64_t getAxis () const
 Gets the axis used for softmax computation.
 
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 &zip) const override
 Serializes the module state to a ZIP archive.
 
std::string toString () const override
 Generates a string representation of this module's configuration.
 

Variables

OperationAttributes attributes_
 Operation attributes and configuration.
 
SoftmaxConfig config_
 Configuration for the Softmax module.
 
std::shared_ptr< UnaryOperation< TDeviceType, TInput, TOutput > > operation_ { nullptr }
 The operation that implements the softmax calculation.
 
std::vector< std::shared_ptr< Tensor< TOutput, MR > > > output_state_
 Collection of output state tensors for caching.
 
std::vector< std::shared_ptr< Tensor< TInput, MR > > > parameters_
 Collection of parameters for this module (empty for Softmax).
 

Files

file  /home/runner/work/Mila/Mila/Mila/Src/Dnn/Modules/Layers/Softmax.ixx
 Implementation of the Softmax activation function module.
 
file  /home/runner/work/Mila/Mila/Mila/Src/Dnn/Modules/Layers/SoftmaxConfig.ixx
 Configuration interface for the Softmax module in the Mila DNN framework.