Attention(in_channels)

Bases: Module

Attention mechanism for feature aggregation.

Parameters:
  • in_channels (int) –

    Input feature dimension.

Notes
  • Implements learnable attention weights
  • Uses softmax normalization
  • Includes dropout regularization
  • Single-head attention mechanism
forward(inputs)

Apply attention mechanism to input features.

Parameters:
  • inputs (list[Tensor]) –

    List of input tensors to be attended.

Returns:
  • Tensor

    Attention-weighted feature aggregation.

Notes

Process:

  1. Stack input tensors
  2. Compute attention weights
  3. Apply softmax normalization
  4. Weighted sum of features