class_docstr: An implementation of the graph learning layer to construct an adjacency matrix.
  For details see this paper: `"Connecting the Dots: Multivariate Time Series Forecasting with Graph Neural Networks."
  <https://arxiv.org/pdf/2005.11650.pdf>`_
  
  Args:
      nnodes (int): Number of nodes in the graph.
      k (int): Number of largest values to consider in constructing the neighbourhood of a node (pick the "nearest" k nodes).
      dim (int): Dimension of the node embedding.
      alpha (float, optional): Tanh alpha for generating adjacency matrix, alpha controls the saturation rate
      xd (int, optional): Static feature dimension, default None.
class_docstr_tok: ["An","implementation","of","the","graph","learning","layer","to","construct","an","adjacency","matrix",".","For","details","see","this","paper",":","`","``","Connecting","the","Dots",":","Multivariate","Time","Series","Forecasting","with","Graph","Neural","Networks",".","''","<","https",":","\/\/arxiv.org\/pdf\/2005.11650.pdf",">","`","_","Args",":","nnodes","(","int",")",":","Number","of","nodes","in","the","graph",".","k","(","int",")",":","Number","of","largest","values","to","consider","in","constructing","the","neighbourhood","of","a","node","(","pick","the","``","nearest","''","k","nodes",")",".","dim","(","int",")",":","Dimension","of","the","node","embedding",".","alpha","(","float",",","optional",")",":","Tanh","alpha","for","generating","adjacency","matrix",",","alpha","controls","the","saturation","rate","xd","(","int",",","optional",")",":","Static","feature","dimension",",","default","None","."]
docstr: Making a forward pass to construct an adjacency matrix from node embeddings.
  
  Arg types:
      * **idx** (Pytorch Long Tensor) - Input indices, a permutation of the number of nodes, default None (no permutation).
      * **FE** (Pytorch Float Tensor, optional) - Static feature, default None.
  Return types:
      * **A** (PyTorch Float Tensor) - Adjacency matrix constructed from node embeddings.
code: def forward(
      self,
      idx: torch.LongTensor,
      FE: Optional[torch.FloatTensor] = None,
  ) -> torch.FloatTensor:
      """
      Making a forward pass to construct an adjacency matrix from node embeddings.
  
      Arg types:
          * **idx** (Pytorch Long Tensor) - Input indices, a permutation of the number of nodes, default None (no permutation).
          * **FE** (Pytorch Float Tensor, optional) - Static feature, default None.
      Return types:
          * **A** (PyTorch Float Tensor) - Adjacency matrix constructed from node embeddings.
      """
  
      if FE is None:
          nodevec1 = self._embedding1(idx)
          nodevec2 = self._embedding2(idx)
      else:
          assert FE.shape[1] == self._static_feature_dim
          nodevec1 = FE[idx, :]
          nodevec2 = nodevec1
  
      nodevec1 = torch.tanh(self._alpha * self._linear1(nodevec1))
      nodevec2 = torch.tanh(self._alpha * self._linear2(nodevec2))
  
      a = torch.mm(nodevec1, nodevec2.transpose(1, 0)) - torch.mm(
          nodevec2, nodevec1.transpose(1, 0)
      )
      A = F.relu(torch.tanh(self._alpha * a))
      mask = torch.zeros(idx.size(0), idx.size(0)).to(A.device)
      mask.fill_(float("0"))
      s1, t1 = A.topk(self._k, 1)
      mask.scatter_(1, t1, s1.fill_(1))
      A = A * mask
      return A
  
imports: from __future__ import division
  import numbers
  from typing import Optional
  import torch
  import torch.nn
  from torch.nn import init
  import torch.nn.functional
label_desc: Use image node_id 3 for calling the GraphConstructor obj's underlying member method code with example usage: obj.forward(idx, FE) and returns: A