lgatr.nets.lgatr_slim.SelfAttention

class lgatr.nets.lgatr_slim.SelfAttention(v_channels, s_channels, num_heads, attn_ratio=1, dropout_prob=None)[source]

Bases: Module

Self-attention module for Lorentz vectors and scalar features.

forward(vectors, scalars, **attn_kwargs)[source]
Parameters:
  • vectors (torch.Tensor) – A tensor of shape (…, v_channels, 4) representing Lorentz vectors.

  • scalars (torch.Tensor) – A tensor of shape (…, s_channels) representing scalar features.

  • **attn_kwargs (dict) – Additional keyword arguments for the attention function.

Returns:

Tensors of the same shape as input representing the normalized vectors and scalars.

Return type:

torch.Tensor, torch.Tensor