|
Mila 0.13.48
Deep Neural Network Library
|
DEPRECATED. More...


Public Types | |
| using | ComponentBase = Component<TDeviceType, TPrecision> |
| using | OperationType = UnaryOperation<TDeviceType, TPrecision> |
Public Member Functions | |
| FusedComponent (const std::string &fused_op_name, const std::vector< std::shared_ptr< ComponentBase > > &original_components, IExecutionContext *exec_context) | |
| Construct fused component from original sequence. | |
| void | backward (const ITensor &input, const ITensor &output_grad, ITensor &input_grad) |
| void | forward (const ITensor &input, ITensor &output) |
| 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. | |
| std::vector< ITensor * > | getParameters () const override |
| Return non-owning pointers to parameter tensors. | |
| void | onBuilding (const shape_t &input_shape) override |
| 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. | |
| Public Member Functions inherited from Mila::Dnn::Component< TDeviceType, TPrecision > | |
| Component (const std::string &name) | |
| Construct component with required name identifier. | |
| virtual | ~Component ()=default |
| virtual void | build (const BuildContext &context) final |
| Build the component with the provided BuildContext (canonical overload). | |
| virtual MemoryStats | getMemoryStats () const =0 |
| Return the current memory allocation breakdown for this component. | |
| const std::string | getName () const |
| Get the component's name identifier. | |
| virtual std::vector< std::string > | getParameterNames () const |
| List all available parameter names for this component. | |
| RuntimeMode | getRuntimeMode () const noexcept |
| Convenience accessor — true if currently in Eval mode. | |
| TrainingMode | getTrainingMode () const noexcept |
| The current runtime behavioral mode of this Component. | |
| virtual const ComponentType | getType () const =0 |
| Get the component type identifier. | |
| virtual bool | isBuilt () const final |
| Returns true if build() has completed successfully. | |
| bool | isInferenceMode () const noexcept |
| bool | isTrainingMode () const noexcept |
| virtual void | loadParameter (const std::string &name, const Serialization::ITensorBlob &blob) |
| Load a parameter from serialized tensor data. | |
| void | setTrainingMode (TrainingMode mode) |
| Set the runtime behavioral mode for this Component. | |
| virtual void | zeroGradients () |
| Clear all model-owned gradients for this component. | |
Protected Member Functions | |
| void | onTrainingChanging (bool is_training) override |
| Protected Member Functions inherited from Mila::Dnn::Component< TDeviceType, TPrecision > | |
| IExecutionContext * | getExecutionContext () const |
| Get the shared execution context. | |
| bool | hasExecutionContext () const noexcept |
| Check if execution context has been set. | |
| template<TensorDataType TParameterPrecision, typename TMemoryResource> | |
| void | loadParameterFromBlob (const std::string ¶m_name, const Serialization::ITensorBlob &blob, Tensor< TParameterPrecision, TMemoryResource > &target, const shape_t &expected_shape) |
| Load a tensor blob into a parameter tensor with validation. | |
| virtual void | onBuilding (const BuildContext &config) |
| Hook invoked by build() to allocate component buffers. | |
| virtual void | onExecutionContextSet () |
| Lifecycle hook: Called immediately after ExecutionContext is set. | |
| virtual void | onTrainingModeChanging (TrainingMode mode) |
| Hook called before TrainingMode transitions. | |
| void | setExecutionContext (IExecutionContext *context) |
| Set the execution context for this component. | |
Private Attributes | |
| IExecutionContext * | exec_context_ |
| std::shared_ptr< OperationType > | operation_ |
| std::vector< std::shared_ptr< ComponentBase > > | original_components_ |
| std::vector< ITensor * > | parameters_ |
Additional Inherited Members | |
| Static Public Member Functions inherited from Mila::Dnn::Component< TDeviceType, TPrecision > | |
| static constexpr DeviceType | getDeviceType () |
| Compile-time device type for this component instance. | |
| static constexpr TensorDataType | getPrecision () noexcept |
| Compile-time tensor precision for this component instance. | |
| Protected Attributes inherited from Mila::Dnn::Component< TDeviceType, TPrecision > | |
| BuildContext | build_context_ { shape_t{ 1 }, RuntimeMode::Training } |
| The BuildContext stored at build time. | |
DEPRECATED.
Generic wrapper for fused backend operations.
Replaces a sequence of components with a single backend operation without exposing a new component type in the public API.
| using Mila::Dnn::FusedComponent< TDeviceType, TPrecision >::ComponentBase = Component<TDeviceType, TPrecision> |
| using Mila::Dnn::FusedComponent< TDeviceType, TPrecision >::OperationType = UnaryOperation<TDeviceType, TPrecision> |
|
inline |
Construct fused component from original sequence.
| fused_op_name | Backend operation name (e.g., "LinearGeluOp") |
| original_components | Original unfused components (for parameter extraction) |
| exec_context | Execution context |

|
inline |
|
inline |
|
inlineoverridevirtual |
Get the compute device id associated with this component.
Must return the device on which parameters and operations execute.
Implements Mila::Dnn::Component< TDeviceType, TPrecision >.
|
inlineoverridevirtual |
Return non-owning pointers to parameter gradient tensors.
Only valid when isTraining() is true.
| std::runtime_error | if called when not in training mode or before the component has been built. |
Implements Mila::Dnn::Component< TDeviceType, TPrecision >.
|
inlineoverridevirtual |
Return non-owning pointers to parameter tensors.
The returned tensor pointers remain valid for the lifetime of the component. Order should be canonical (weights before biases).
Implements Mila::Dnn::Component< TDeviceType, TPrecision >.
|
inlineoverride |
|
inlineoverrideprotected |
|
inlineoverridevirtual |
Return number of trainable parameters.
For leaf components this is the element count of owned parameter tensors. CompositeComponent and Network implementations should return the recursive aggregate across all children.
Implements Mila::Dnn::Component< TDeviceType, TPrecision >.
|
inlineoverridevirtual |
Implements Mila::Dnn::Component< TDeviceType, TPrecision >.
|
inlineoverridevirtual |
Wait for outstanding device work submitted by this component.
On CPU this may be a no-op. Use to ensure results are visible to the host or to measure synchronous timings.
Implements Mila::Dnn::Component< TDeviceType, TPrecision >.
|
inlineoverridevirtual |
Produce a short, human-readable description of the component.
Implementations should keep output concise and avoid throwing.
Implements Mila::Dnn::Component< TDeviceType, TPrecision >.

|
private |
|
private |
|
private |
|
private |