|
Mila 0.13.48
Deep Neural Network Library
|
Exported Modules | |
| module | Compute.UnaryOperation |
| module | Dnn.TensorDataType |
| module | Compute.MemoryResource |
| module | Dnn.TensorTypes |
| module | Dnn.Components.TokenEmbeddingConfig |
| module | Compute.DeviceTypeTraits |
| module | Dnn.TensorHelpers |
| module | Logging.Logger |
| module | Compute.Device |
| module | Compute.DeviceId |
| module | Dnn.Tensor |
| module | Serialization.Tensor |
| module | Dnn.TensorDataTypeTraits |
| module | Serialization.ModelArchive |
| module | Compute.ExecutionContextFactory |
| module | Dnn.Component |
| module | Compute.CpuMemoryResource |
| module | Dnn.ComponentType |
| module | Dnn.TensorOps |
| module | Dnn.TensorOps |
| module | Compute.OperationTraits |
| module | Compute.DeviceType |
| module | Dnn.ITensor |
| module | Serialization.Mode |
| module | Compute.ExecutionContext |
Classes | |
| class | Mila::Dnn::TokenEmbedding< TDeviceType, TIndex, TPrecision > |
| Pure token embedding component (device-templated). More... | |
Typedefs | |
| using | ComponentBase = Component<TDeviceType, TPrecision> |
| using | EmbeddingTensorType = Tensor<TPrecision, MR> |
| using | MR = typename DeviceTypeTraits<TDeviceType>::memory_resource |
| using | OpType = typename OperationTraits<OperationType::TokenEmbeddingOp, TDeviceType, TPrecision>::type |
| using | TokenIndexType = Tensor<TIndex, MR> |
Functions | |
| TokenEmbedding (const std::string &name, const TokenEmbeddingConfig &config, std::optional< DeviceId > device_id=std::nullopt) | |
| Construct a TokenEmbedding component. | |
| ~TokenEmbedding () override=default | |
| TokenIndexType & | backward (const TokenIndexType &input, const EmbeddingTensorType &output_grad) |
| Backward pass — accumulates gradients into wte. | |
| void | createOperation () |
| EmbeddingTensorType & | forward (const TokenIndexType &input) |
| Forward pass — returns component-owned embeddings tensor. | |
| DeviceId | getDeviceId () const override |
| Get the compute device id associated with this component. | |
| int64_t | getEmbeddingDim () const noexcept |
| std::vector< ITensor * > | getGradients () const override |
| Return non-owning pointers to parameter gradient tensors. | |
| MemoryStats | getMemoryStats () const override |
| Return the current memory allocation breakdown for this component. | |
| std::vector< ITensor * > | getParameters () const override |
| Return non-owning pointers to parameter tensors. | |
| const ComponentType | getType () const override |
| Get the component type identifier. | |
| int64_t | getVocabSize () const noexcept |
| EmbeddingTensorType * | getWteGrad () const noexcept |
| void | initializeParameterGradients () |
| void | initializeParameters () |
| void | loadParameter (const std::string &name, const ITensorBlob &blob) override |
| Load a parameter from serialized tensor data. | |
| 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 &context) const |
| void | zeroGradients () override |
| Clear all model-owned gradients for this component. | |
Variables | |
| TokenEmbeddingConfig | config_ |
| std::unique_ptr< EmbeddingTensorType > | current_output_view_ { nullptr } |
| std::unique_ptr< TokenIndexType > | input_grad_ { nullptr } |
| int64_t | max_batch_size_ { 0 } |
| int64_t | max_seq_len_ { 0 } |
| std::shared_ptr< OpType > | operation_ { nullptr } |
| std::unique_ptr< EmbeddingTensorType > | output_ { nullptr } |
| std::unique_ptr< IExecutionContext > | owned_exec_context_ { nullptr } |
| std::unique_ptr< EmbeddingTensorType > | wte_ { nullptr } |
| std::unique_ptr< EmbeddingTensorType > | wte_grad_ { nullptr } |
Files | |
| file | /__w/Mila/Mila/Mila/Src/Dnn/Components/Embeddings/TokenEmbedding.ixx |
| Device-templated TokenEmbedding component. | |