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

Exported Modules

module  Compute.DeviceTypeTraits
module  Dnn.ComponentType
module  Dnn.TensorTypes
module  Compute.OperationTraits
module  Compute.DeviceType
module  Dnn.ApproximationMethod
module  Dnn.ITensor
module  Serialization.Mode
module  Serialization.Tensor
module  Logging.Logger
module  Compute.IExecutionContext
module  Compute.UnaryOperation
module  Dnn.TensorDataType
module  Compute.ExecutionContextFactory
module  Dnn.TensorDataTypeTraits
module  Serialization.ModelArchive
module  Compute.CpuMemoryResource
module  Dnn.Component
module  Compute.DeviceId
module  Dnn.Tensor
module  Dnn.Components.GeluConfig
module  Compute.Device

Classes

class  Mila::Dnn::Gelu< TDeviceType, TPrecision >
 Gaussian Error Linear Unit (GELU) activation component. More...

Typedefs

using ComponentBase = Component<TDeviceType, TPrecision>
using MR = typename DeviceTypeTraits<TDeviceType>::memory_resource
using OpType = typename OperationTraits<OperationType::GeluOp, TDeviceType, TPrecision>::type
using TensorType = Tensor<TPrecision, MR>

Functions

 Gelu (const std::string &name, const GeluConfig &config, std::optional< DeviceId > device_id=std::nullopt)
 ~Gelu () override=default
TensorTypebackward (const TensorType &input, const TensorType &output_grad)
 Compute gradients with respect to the component input.
void createOperation ()
 Create backend UnaryOperation from OperationRegistry.
TensorTypeforward (const TensorType &input)
 Run the forward computation for this GELU component.
static std::unique_ptr< GelufromArchive_ (ModelArchive &archive, const std::string &component_name, IExecutionContext *exec_context)
ApproximationMethod getApproximationMethod () const
 Return the configured GELU approximation method.
DeviceId getDeviceId () const override
 Get the device identifier for this component.
std::vector< ITensor * > getGradients () const override
 Get parameter gradient tensors.
MemoryStats getMemoryStats () const override
 Return memory allocation breakdown.
std::vector< ITensor * > getParameters () const override
 Get trainable parameter tensors.
const ComponentType getType () const override
 Get the component type identifier.
void onBuilding (const BuildContext &build_context) override
 Hook invoked during build() to initialize backend operation.
void onExecutionContextSet () override
 Hook invoked after ExecutionContext is set.
void onTrainingModeChanging (TrainingMode training_mode) override
 Hook invoked when training mode changes.
size_t parameterCount () const override
 Number of trainable parameters.
void save_ (ModelArchive &archive, SerializationMode mode) const override
 Persist component state to archive.
void synchronize () override
 Wait for all asynchronous work submitted by this component to complete.
std::string toString () const override
 Generate human-readable description of the component.
static void validateMetadata_ (const SerializationMetadata &meta, const std::string &component_name)
 Validate metadata from archive during deserialization.

Variables

GeluConfig config_
std::unique_ptr< TensorTypeinput_grad_ { nullptr }
std::shared_ptr< OpTypeoperation_ { nullptr }
std::unique_ptr< TensorTypeoutput_ { nullptr }
std::optional< TensorTypeoutput_view_
std::unique_ptr< IExecutionContextowned_exec_context_ { nullptr }

Files

file  /__w/Mila/Mila/Mila/Src/Dnn/Components/Activations/Gelu/Gelu.ixx
 GELU activation component implementation.