class_docstr: Description
  -----------
  A discriminator used to let the network to discrimate
  between positive (neighborhood of center node) and
  negative (any neighborhood in graph) samplings.
  
  Parameters
  ----------
  feat_dim : int
      The number of channels of node features.
class_docstr_tok: ["Description","--","--","--","--","--","-","A","discriminator","used","to","let","the","network","to","discrimate","between","positive","(","neighborhood","of","center","node",")","and","negative","(","any","neighborhood","in","graph",")","samplings",".","Parameters","--","--","--","--","--","feat_dim",":","int","The","number","of","channels","of","node","features","."]
docstr: Parameters
  ----------
  h_x : torch.Tensor
      Node features, shape: :obj:`(num_nodes, feat_dim)`
  h_pos : torch.Tensor
      The node features of positive samples
      It has the same shape as :obj:`h_x`
  h_neg : torch.Tensor
      The node features of negative samples
      It has the same shape as :obj:`h_x`
  bias_pos : torch.Tensor
      Bias parameter vector for positive scores
      shape: :obj:`(num_nodes)`
  bias_neg : torch.Tensor
      Bias parameter vector for negative scores
      shape: :obj:`(num_nodes)`
  
  Returns
  -------
  (torch.Tensor, torch.Tensor)
      The output scores with shape (2 * num_nodes,), (num_nodes,)
docstr_tok: ["Parameters","--","--","--","--","--","h_x",":","torch.Tensor","Node","features",",","shape",":",":","obj",":","`","(","num_nodes",",","feat_dim",")","`","h_pos",":","torch.Tensor","The","node","features","of","positive","samples","It","has","the","same","shape","as",":","obj",":","`","h_x","`","h_neg",":","torch.Tensor","The","node","features","of","negative","samples","It","has","the","same","shape","as",":","obj",":","`","h_x","`","bias_pos",":","torch.Tensor","Bias","parameter","vector","for","positive","scores","shape",":",":","obj",":","`","(","num_nodes",")","`","bias_neg",":","torch.Tensor","Bias","parameter","vector","for","negative","scores","shape",":",":","obj",":","`","(","num_nodes",")","`","Returns","--","--","--","-","(","torch.Tensor",",","torch.Tensor",")","The","output","scores","with","shape","(","2","*","num_nodes",",",")",",","(","num_nodes",",",")"]
code: def forward(
      self,
      h_x: Tensor,
      h_pos: Tensor,
      h_neg: Tensor,
      bias_pos: Optional[Tensor] = None,
      bias_neg: Optional[Tensor] = None,
  ):
      """
      Parameters
      ----------
      h_x : torch.Tensor
          Node features, shape: :obj:`(num_nodes, feat_dim)`
      h_pos : torch.Tensor
          The node features of positive samples
          It has the same shape as :obj:`h_x`
      h_neg : torch.Tensor
          The node features of negative samples
          It has the same shape as :obj:`h_x`
      bias_pos : torch.Tensor
          Bias parameter vector for positive scores
          shape: :obj:`(num_nodes)`
      bias_neg : torch.Tensor
          Bias parameter vector for negative scores
          shape: :obj:`(num_nodes)`
  
      Returns
      -------
      (torch.Tensor, torch.Tensor)
          The output scores with shape (2 * num_nodes,), (num_nodes,)
      """
      score_pos = self.affine(h_pos, h_x).squeeze()
      score_neg = self.affine(h_neg, h_x).squeeze()
      if bias_pos is not None:
          score_pos = score_pos + bias_pos
      if bias_neg is not None:
          score_neg = score_neg + bias_neg
  
      logits = torch.cat((score_pos, score_neg), 0)
  
      return logits, score_pos
  
imports: from typing import Optional
  import dgl
  import torch
  import torch.nn
  from dgl import DGLGraph
  from dgl.nn import GraphConv
  from torch import Tensor
label_desc: Use image node_id 3 for calling the Discriminator obj's underlying member method code with example usage: obj.forward(h_x, h_pos, h_neg, bias_pos, bias_neg) and returns: logits,  score_pos