class_docstr: Layer for learning contextual information for bonds.
  
  The layer is used in Grover architecture to learn contextual information of a bond by predicting
  the context of a bond from the bond embedding in a multi-class classification setting.
  The contextual information of a bond are encoded as strings (ex: '(DOUBLE-STEREONONE-NONE)_C-(SINGLE-STEREONONE-NONE)2').
  
  Example
  -------
  >>> from deepchem.models.torch_models.grover_layers import GroverBondVocabPredictor
  >>> num_bonds = 20
  >>> in_features, vocab_size = 16, 10
  >>> layer = GroverBondVocabPredictor(vocab_size, in_features)
  >>> embedding = torch.randn(num_bonds * 2, in_features)
  >>> result = layer(embedding)
  >>> result.shape
  torch.Size([20, 10])
  
  Reference
  ---------
  .. Rong, Yu, et al. "Self-supervised graph transformer on large-scale molecular data." Advances in Neural Information Processing Systems 33 (2020): 12559-12571.
class_docstr_tok: ["Layer","for","learning","contextual","information","for","bonds",".","The","layer","is","used","in","Grover","architecture","to","learn","contextual","information","of","a","bond","by","predicting","the","context","of","a","bond","from","the","bond","embedding","in","a","multi-class","classification","setting",".","The","contextual","information","of","a","bond","are","encoded","as","strings","(","ex",":","'","(","DOUBLE-STEREONONE-NONE",")","_C-","(","SINGLE-STEREONONE-NONE",")","2","'",")",".","Example","--","--","--","-",">",">",">","from","deepchem.models.torch_models.grover_layers","import","GroverBondVocabPredictor",">",">",">","num_bonds","=","20",">",">",">","in_features",",","vocab_size","=","16",",","10",">",">",">","layer","=","GroverBondVocabPredictor","(","vocab_size",",","in_features",")",">",">",">","embedding","=","torch.randn","(","num_bonds","*","2",",","in_features",")",">",">",">","result","=","layer","(","embedding",")",">",">",">","result.shape","torch.Size","(","[","20",",","10","]",")","Reference","--","--","--","--","-","..","Rong",",","Yu",",","et","al",".","``","Self-supervised","graph","transformer","on","large-scale","molecular","data",".","''","Advances","in","Neural","Information","Processing","Systems","33","(","2020",")",":","12559-12571","."]
docstr: Parameters
  ----------
  embeddings: torch.Tensor
      bond embeddings of shape (num_bond, in_features)
  
  Returns
  -------
  logits: torch.Tensor
      the prediction for each bond, (num_bond, vocab_size)
code: def forward(self, embeddings):
      """
      Parameters
      ----------
      embeddings: torch.Tensor
          bond embeddings of shape (num_bond, in_features)
  
      Returns
      -------
      logits: torch.Tensor
          the prediction for each bond, (num_bond, vocab_size)
      """
      nm_bonds = embeddings.shape[0]
      # The bond and rev bond have even and odd ids respectively.
      ids1 = list(range(0, nm_bonds, 2))
      ids2 = list(range(1, nm_bonds, 2))
      logits = self.linear(embeddings[ids1]) + self.linear_rev(
          embeddings[ids2]
      )
      return self.logsoftmax(logits)
  
imports: from typing import List, Dict
  import numpy
  from scipy import stats
  from deepchem.models.torch_models.readout import GroverReadout
  from deepchem.models.torch_models.layers import SublayerConnection, PositionwiseFeedForward
label_desc: Use image node_id 2 for calling the GroverBondVocabPredictor obj's underlying member method code with example usage: obj.forward(embeddings) and returns: self