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

Exported Modules

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

Classes

class  Mila::Dnn::Swiglu< TDeviceType, TPrecision >
 SwiGLU activation component. More...

Typedefs

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

Functions

 Swiglu (const std::string &name, const SwigluConfig &config, std::optional< DeviceId > device_id=std::nullopt)
 ~Swiglu () override=default
TensorTypebackward (const TensorType &input, const TensorType &output_grad)
void createOperation ()
TensorTypeforward (const TensorType &input)
static std::unique_ptr< SwiglufromArchive_ (ModelArchive &archive, const std::string &component_name, IExecutionContext *exec_context)
DeviceId getDeviceId () const override
 Get the compute device id associated with this component.
std::vector< ITensor * > getGradients () const override
 Return non-owning pointers to parameter gradient tensors.
MemoryStats getMemoryStats () const override
 Return memory allocation breakdown.
std::vector< ITensor * > getParameters () const override
 Return non-owning pointers to parameter tensors.
const ComponentType getType () const override
 Get the component type identifier.
void onBuilding (const BuildContext &build_context) override
 Hook invoked by build() to allocate component buffers.
void onExecutionContextSet () override
 Lifecycle hook: Called immediately after ExecutionContext is set.
void onTrainingModeChanging (TrainingMode training_mode) override
 Hook called before TrainingMode transitions.
size_t parameterCount () const override
 Return number of trainable parameters.
void save_ (ModelArchive &archive, SerializationMode mode) const override
void synchronize () override
 Wait for outstanding device work submitted by this component.
std::string toString () const override
 Produce a short, human-readable description of the component.
void validateBuildContext (const BuildContext &build_context) const
static void validateMetadata_ (const SerializationMetadata &meta, const std::string &component_name)

Variables

SwigluConfig config_
std::unique_ptr< TensorTypeinput_grad_ { nullptr }
shape_t input_shape_
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/Swiglu/Swiglu.ixx
 SwiGLU activation component implementation.