class_docstr: Message weighting by attention.
docstr: Initialize the module.
  
  :param message_dim: >0
      the message dimension. has to be divisible by num_heads
      .. todo:: change to multiplicative instead of divisive to make this easier to use
  :param num_heads: >0
      the number of attention heads
  :param dropout:
      the attention dropout
  :raises ValueError: If ``message_dim`` is not divisible by ``num_heads``
docstr_tok: ["Initialize","the","module",".",":","param","message_dim",":",">","0","the","message","dimension",".","has","to","be","divisible","by","num_heads","..","todo",":",":","change","to","multiplicative","instead","of","divisive","to","make","this","easier","to","use",":","param","num_heads",":",">","0","the","number","of","attention","heads",":","param","dropout",":","the","attention","dropout",":","raises","ValueError",":","If","``","message_dim","``","is","not","divisible","by","``","num_heads","``"]
code: def __init__(
      self,
      message_dim: int,
      num_heads: int = 8,
      dropout: float = 0.1,
  ):
      """
      Initialize the module.
  
      :param message_dim: >0
          the message dimension. has to be divisible by num_heads
          .. todo:: change to multiplicative instead of divisive to make this easier to use
      :param num_heads: >0
          the number of attention heads
      :param dropout:
          the attention dropout
      :raises ValueError: If ``message_dim`` is not divisible by ``num_heads``
      """
      super().__init__()
      if 0 != message_dim % num_heads:
          raise ValueError(
              f"output_dim={message_dim} must be divisible by num_heads={num_heads}!"
          )
      self.num_heads = num_heads
      self.weight = nn.Parameter(
          data=nn.init.xavier_uniform_(
              torch.empty(num_heads, 2 * message_dim // num_heads)
          )
      )
      self.activation = nn.LeakyReLU(negative_slope=0.1)
      self.attention_dim = message_dim // num_heads
      self.dropout = nn.Dropout(dropout)
  
imports: from abc import abstractmethod
  from typing import ClassVar, Optional, Union
  import torch
  from class_resolver import ClassResolver
  from torch import nn
  from ..utils import einsum
label_desc: Use image node_id 1 to create a new AttentionEdgeWeighting object from inherited base classes: EdgeWeighting with example: obj = AttentionEdgeWeighting(message_dim, num_heads, dropout)