|
Mila 0.13.48
Deep Neural Network Library
|
CUDA Residual operation implementing the BinaryOperation interface. More...


Public Types | |
| using | ConfigType = ResidualConfig |
| using | CudaExecutionContext = ExecutionContext<DeviceType::Cuda> |
| using | MR = CudaDeviceMemoryResource |
| using | NativeType = typename Mila::Dnn::Compute::Cuda::TensorDataTypeMap<TPrecision>::device_type |
| Public Types inherited from Mila::Dnn::Compute::BinaryOperation< DeviceType::Cuda, TInputA, TInputA, TInputA > | |
| using | MR |
| using | ParameterGradTensor |
| using | ParameterTensor |
| using | TensorLeftType |
| using | TensorOutputType |
| using | TensorRightType |
| Public Types inherited from Mila::Dnn::Compute::Operation< TDeviceType, TPrecision > | |
| using | DataTypeTraits |
Public Member Functions | |
| CudaResidualOp (IExecutionContext *context, const ResidualConfig &config) | |
| Construct with a non-null CUDA execution context. | |
| void | backward (const ITensor &input_A, const ITensor &input_B, const ITensor &output_grad, ITensor &A_grad, ITensor &B_grad) const override |
| Backward pass. | |
| void | build (const BuildContext &config) override |
| Prepare the operation for a concrete input shape. | |
| void | forward (const ITensor &input_A, const ITensor &input_B, ITensor &output) const override |
| Forward pass: element-wise addition Y = X1 + X2 using CUDA kernel. | |
| std::string | getName () const override |
| Human-readable operation name. | |
| OperationType | getOperationType () const override |
| Operation type identifier. | |
| Public Member Functions inherited from Mila::Dnn::Compute::BinaryOperation< DeviceType::Cuda, TInputA, TInputA, TInputA > | |
| virtual | ~BinaryOperation ()=default |
| Public Member Functions inherited from Mila::Dnn::Compute::Operation< TDeviceType, TPrecision > | |
| virtual | ~Operation ()=default |
| virtual void | clearGradients () noexcept |
| Clear any cached gradient pointers held by the operation. | |
| virtual TensorDataType | getDataType () const |
| Tensor data type for this operation. | |
| virtual DeviceType | getDeviceType () const |
| Device type for this operation. | |
| virtual std::size_t | getStateMemorySize () const |
| Returns the number of bytes of state memory allocated by this operation. | |
| virtual bool | isBuilt () const |
| Whether build() completed successfully for a concrete input shape. | |
| virtual bool | isEvalMode () const |
| Query whether operation is configured for training. | |
| virtual void | setGradients (ITensor *weight_grad, ITensor *bias_grad) |
| Bind module-owned gradient tensors to the operation. | |
| virtual void | setParameters (ITensor *weight, ITensor *bias) |
| Bind module-owned parameter tensors to the operation. | |
| virtual void | setTrainingMode (TrainingMode training_mode) |
| Configure operation training-mode behavior. | |
Private Attributes | |
| ResidualConfig | config_ |
| CudaExecutionContext * | context_ { nullptr } |
| int64_t | max_size_ { 0 } |
| float | scale_ { 1.0f } |
Additional Inherited Members | |
| Static Public Attributes inherited from Mila::Dnn::Compute::Operation< TDeviceType, TPrecision > | |
| static constexpr TensorDataType | data_type |
| static constexpr DeviceType | device_type |
| Static Protected Member Functions inherited from Mila::Dnn::Compute::BinaryOperation< DeviceType::Cuda, TInputA, TInputA, TInputA > | |
| static const TensorLeftType & | asLeftTensor (const ITensor &t) |
| static TensorOutputType & | asOutputTensor (ITensor &t) |
| static const TensorRightType & | asRightTensor (const ITensor &t) |
| Protected Attributes inherited from Mila::Dnn::Compute::Operation< TDeviceType, TPrecision > | |
| bool | is_built_ |
| TrainingMode | training_mode_ |
CUDA Residual operation implementing the BinaryOperation interface.
| TInputA | Precision of first input tensor |
| TInputB | Precision of second input tensor |
| TPrecision | Computation precision |
| using Mila::Dnn::Compute::Cuda::Residual::CudaResidualOp< TInputA, TInputB, TPrecision >::ConfigType = ResidualConfig |
| using Mila::Dnn::Compute::Cuda::Residual::CudaResidualOp< TInputA, TInputB, TPrecision >::CudaExecutionContext = ExecutionContext<DeviceType::Cuda> |
| using Mila::Dnn::Compute::Cuda::Residual::CudaResidualOp< TInputA, TInputB, TPrecision >::MR = CudaDeviceMemoryResource |
| using Mila::Dnn::Compute::Cuda::Residual::CudaResidualOp< TInputA, TInputB, TPrecision >::NativeType = typename Mila::Dnn::Compute::Cuda::TensorDataTypeMap<TPrecision>::device_type |
|
inline |
Construct with a non-null CUDA execution context.
The context parameter is required and validated at runtime. Callers must pass a std::shared_ptr<ExecutionContext<DeviceType::Cuda>>.
|
inlineoverridevirtual |
Backward pass.
Implements Mila::Dnn::Compute::BinaryOperation< DeviceType::Cuda, TInputA, TInputA, TInputA >.
|
inlineoverridevirtual |
Prepare the operation for a concrete input shape.
Default implementation is a no-op. Operations requiring shape-dependent setup should override this method.
Reimplemented from Mila::Dnn::Compute::Operation< TDeviceType, TPrecision >.
|
inlineoverridevirtual |
Forward pass: element-wise addition Y = X1 + X2 using CUDA kernel.
Input and output buffers are obtained from ITensor::rawData() and must be device pointers compatible with the CUDA kernels.
Implements Mila::Dnn::Compute::BinaryOperation< DeviceType::Cuda, TInputA, TInputA, TInputA >.
|
inlineoverridevirtual |
Human-readable operation name.
Implements Mila::Dnn::Compute::Operation< TDeviceType, TPrecision >.
|
inlineoverridevirtual |
Operation type identifier.
Implements Mila::Dnn::Compute::Operation< TDeviceType, TPrecision >.
|
private |
|
private |
|
private |
|
private |