class_docstr: The functional group prediction task for self-supervised learning.
  
  Molecules have functional groups in them. This module is used for predicting
  the functional group and the problem is formulated as an multi-label classification problem.
  
  Parameters
  ----------
  functional_group_size: int,
      size of functional group
  in_features: int,
      hidden_layer size, default 128
  
  Example
  -------
  >>> from deepchem.models.torch_models.grover_layers import GroverFunctionalGroupPredictor
  >>> in_features, functional_group_size = 8, 20
  >>> num_atoms, num_bonds = 10, 20
  >>> predictor = GroverFunctionalGroupPredictor(functional_group_size=20, in_features=8)
  >>> atom_scope, bond_scope = [(0, 3), (3, 3), (6, 4)], [(0, 5), (5, 4), (9, 11)]
  >>> embeddings = {}
  >>> embeddings['bond_from_atom'] = torch.randn(num_bonds, in_features)
  >>> embeddings['bond_from_bond'] = torch.randn(num_bonds, in_features)
  >>> embeddings['atom_from_atom'] = torch.randn(num_atoms, in_features)
  >>> embeddings['atom_from_bond'] = torch.randn(num_atoms, in_features)
  >>> result = predictor(embeddings, atom_scope, bond_scope)
  
  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: ["The","functional","group","prediction","task","for","self-supervised","learning",".","Molecules","have","functional","groups","in","them",".","This","module","is","used","for","predicting","the","functional","group","and","the","problem","is","formulated","as","an","multi-label","classification","problem",".","Parameters","--","--","--","--","--","functional_group_size",":","int",",","size","of","functional","group","in_features",":","int",",","hidden_layer","size",",","default","128","Example","--","--","--","-",">",">",">","from","deepchem.models.torch_models.grover_layers","import","GroverFunctionalGroupPredictor",">",">",">","in_features",",","functional_group_size","=","8",",","20",">",">",">","num_atoms",",","num_bonds","=","10",",","20",">",">",">","predictor","=","GroverFunctionalGroupPredictor","(","functional_group_size=20",",","in_features=8",")",">",">",">","atom_scope",",","bond_scope","=","[","(","0",",","3",")",",","(","3",",","3",")",",","(","6",",","4",")","]",",","[","(","0",",","5",")",",","(","5",",","4",")",",","(","9",",","11",")","]",">",">",">","embeddings","=","{","}",">",">",">","embeddings","[","'bond_from_atom","'","]","=","torch.randn","(","num_bonds",",","in_features",")",">",">",">","embeddings","[","'bond_from_bond","'","]","=","torch.randn","(","num_bonds",",","in_features",")",">",">",">","embeddings","[","'atom_from_atom","'","]","=","torch.randn","(","num_atoms",",","in_features",")",">",">",">","embeddings","[","'atom_from_bond","'","]","=","torch.randn","(","num_atoms",",","in_features",")",">",">",">","result","=","predictor","(","embeddings",",","atom_scope",",","bond_scope",")","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: The forward function for the GroverFunctionalGroupPredictor (semantic motif prediction) layer.
  It takes atom/bond embeddings produced from node and bond hidden states from GroverEmbedding module
  and the atom, bond scopes and produces prediction logits for different each embedding.
  The scopes are used to differentiate atoms/bonds belonging to a molecule in a batched molecular graph.
  
  Parameters
  ----------
  embedding: Dict
      The input embeddings organized as an dictionary. The input embeddings are output of GroverEmbedding layer.
  atom_scope: List
      The scope for atoms.
  bond_scope: List
      The scope for bonds
  
  Returns
  -------
  preds: Dict
      A dictionary containing the predicted logits of functional group from four different types of input embeddings. The key and their corresponding predictions
  are described below.
   - atom_from_atom - prediction logits from atom embeddings generated via node hidden states
   - atom_from_bond - prediction logits from atom embeddings generated via bond hidden states
   - bond_from_atom - prediction logits from bond embeddings generated via node hidden states
   - bond_from_bond - prediction logits from bond embeddings generated via bond hidden states
code: def forward(
      self, embeddings: Dict, atom_scope: List, bond_scope: List
  ):
      """
      The forward function for the GroverFunctionalGroupPredictor (semantic motif prediction) layer.
      It takes atom/bond embeddings produced from node and bond hidden states from GroverEmbedding module
      and the atom, bond scopes and produces prediction logits for different each embedding.
      The scopes are used to differentiate atoms/bonds belonging to a molecule in a batched molecular graph.
  
      Parameters
      ----------
      embedding: Dict
          The input embeddings organized as an dictionary. The input embeddings are output of GroverEmbedding layer.
      atom_scope: List
          The scope for atoms.
      bond_scope: List
          The scope for bonds
  
      Returns
      -------
      preds: Dict
          A dictionary containing the predicted logits of functional group from four different types of input embeddings. The key and their corresponding predictions
      are described below.
       - atom_from_atom - prediction logits from atom embeddings generated via node hidden states
       - atom_from_bond - prediction logits from atom embeddings generated via bond hidden states
       - bond_from_atom - prediction logits from bond embeddings generated via node hidden states
       - bond_from_bond - prediction logits from bond embeddings generated via bond hidden states
      """
      preds_bond_from_atom = self.linear_bond_from_atom(
          self.readout(embeddings["bond_from_atom"], bond_scope)
      )
      preds_bond_from_bond = self.linear_bond_from_bond(
          self.readout(embeddings["bond_from_bond"], bond_scope)
      )
  
      preds_atom_from_atom = self.linear_atom_from_atom(
          self.readout(embeddings["atom_from_atom"], atom_scope)
      )
      preds_atom_from_bond = self.linear_atom_from_bond(
          self.readout(embeddings["atom_from_bond"], atom_scope)
      )
  
      return {
          "atom_from_atom": preds_atom_from_atom,
          "atom_from_bond": preds_atom_from_bond,
          "bond_from_atom": preds_bond_from_atom,
          "bond_from_bond": preds_bond_from_bond,
      }
  
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 GroverFunctionalGroupPredictor obj's underlying member method code with example usage: obj.forward(embeddings, atom_scope, bond_scope) and returns: dict