class_docstr: The link encoder module from the `"Do We Really Need Complicated
  Model Architectures for Temporal Networks?"
  <https://openreview.net/forum?id=ayPPc0SyLv1>`_ paper.
  It is composed of two components: (1) :class:`TemporalEncoding` maps each
  edge timestamp to a :obj:`time_channels`-dimensional vector; (2) an MLP
  that groups and maps the :math:`k`-latest encoded timestamps and edge
  features to a :obj:`out_channels`-dimensional representation.
  
  Args:
      k (int): The number of most recent temporal links to use.
      in_channels (int): The edge feature dimensionality.
      hidden_channels (int): Size of each hidden sample.
      time_channels (int): Size of encoded timestamp.
      out_channels (int): Size of each output sample.
      is_sorted (bool, optional): If set to :obj:`True`, assumes that
          :obj:`edge_index` is sorted by column and the
          rows are sorted according to :obj:`edge_time`
          within individual neighborhoods. This avoids internal
          re-sorting of the data and can improve runtime and memory
          efficiency. (default: :obj:`False`)
      dropout (float, optional): Dropout probability of the MLP layer.
          (default: :obj:`0.0`)
code: def __init__(
      self,
      k: int,
      in_channels: int,
      hidden_channels: int,
      out_channels: int,
      time_channels: int,
      is_sorted: bool = False,
      dropout: float = 0.0,
  ):
      super().__init__()
  
      self.k = k
      self.in_channels = in_channels
      self.hidden_channels = hidden_channels
      self.out_channels = out_channels
      self.time_channels = time_channels
      self.is_sorted = is_sorted
      self.dropout = dropout
  
      self.temporal_encoder = TemporalEncoding(time_channels)
      self.temporal_head = Linear(
          time_channels + in_channels, hidden_channels
      )
  
      self.mlp_mixer = (
          _MLPMixer(  # MLP that summarizes temporal embeddings:
              num_tokens=k,
              in_channels=hidden_channels,
              out_channels=out_channels,
              dropout=dropout,
          )
      )
  
imports: import numpy
  import torch
  import torch.nn.functional
  from torch import Tensor
  from torch.nn import LayerNorm, Linear
  from torch_geometric.nn import TemporalEncoding
  from torch_geometric.utils import scatter, to_dense_batch
label_desc: Use image node_id 1 to create a new LinkEncoder object from inherited base classes: torch.nn with example: obj = LinkEncoder(k, in_channels, hidden_channels, out_channels, time_channels, is_sorted, dropout)