class_docstr: GroverTransEncoder for encoding a molecular graph
  
  The GroverTransEncoder layer is used for encoding a molecular graph.
  The layer returns 4 outputs. They are atom messages aggregated from atom hidden states,
  atom messages aggregated from bond hidden states, bond messages aggregated from atom hidden
  states, bond messages aggregated from bond hidden states.
  
  Parameters
  ----------
  hidden_size: int
      the hidden size of the model.
  edge_fdim: int
      the dimension of additional feature for edge/bond.
  node_fdim: int
      the dimension of additional feature for node/atom.
  depth: int
      Dynamic message passing depth for use in MPNEncoder
  undirected: bool
      The message passing is undirected or not
  dropout: float
      the dropout ratio
  activation: str
      the activation function
  num_mt_block: int
      the number of mt block.
  num_head: int
      the number of attention AttentionHead.
  bias: bool
      enable bias term in all linear layers.
  res_connection: bool
      enables the skip-connection in MTBlock.
class_docstr_tok: ["GroverTransEncoder","for","encoding","a","molecular","graph","The","GroverTransEncoder","layer","is","used","for","encoding","a","molecular","graph",".","The","layer","returns","4","outputs",".","They","are","atom","messages","aggregated","from","atom","hidden","states",",","atom","messages","aggregated","from","bond","hidden","states",",","bond","messages","aggregated","from","atom","hidden","states",",","bond","messages","aggregated","from","bond","hidden","states",".","Parameters","--","--","--","--","--","hidden_size",":","int","the","hidden","size","of","the","model",".","edge_fdim",":","int","the","dimension","of","additional","feature","for","edge\/bond",".","node_fdim",":","int","the","dimension","of","additional","feature","for","node\/atom",".","depth",":","int","Dynamic","message","passing","depth","for","use","in","MPNEncoder","undirected",":","bool","The","message","passing","is","undirected","or","not","dropout",":","float","the","dropout","ratio","activation",":","str","the","activation","function","num_mt_block",":","int","the","number","of","mt","block",".","num_head",":","int","the","number","of","attention","AttentionHead",".","bias",":","bool","enable","bias","term","in","all","linear","layers",".","res_connection",":","bool","enables","the","skip-connection","in","MTBlock","."]
docstr: Forward layer
  
  Parameters
  ----------
  batch: Tuple
      A tuple of tensors representing grover attributes
  
  Returns
  -------
  embeddings: Tuple[Tuple[torch.Tensor, torch.Tensor], Tuple[torch.Tensor, torch.Tensor]]
      Embeddings for atom generated from hidden state of nodes and bonds and embeddings of bond generated from hidden states of nodes and bond.
code: def forward(self, batch):
      """Forward layer
  
      Parameters
      ----------
      batch: Tuple
          A tuple of tensors representing grover attributes
  
      Returns
      -------
      embeddings: Tuple[Tuple[torch.Tensor, torch.Tensor], Tuple[torch.Tensor, torch.Tensor]]
          Embeddings for atom generated from hidden state of nodes and bonds and embeddings of bond generated from hidden states of nodes and bond.
      """
  
      f_atoms, f_bonds, a2b, b2a, b2revb, a_scope, b_scope, a2a = batch
  
      node_batch = (
          f_atoms,
          f_bonds,
          a2b,
          b2a,
          b2revb,
          a_scope,
          b_scope,
          a2a,
      )
      edge_batch = (
          f_atoms,
          f_bonds,
          a2b,
          b2a,
          b2revb,
          a_scope,
          b_scope,
          a2a,
      )
  
      original_f_atoms, original_f_bonds = f_atoms, f_bonds
  
      for (
          nb
      ) in self.node_blocks:  # atom messages. Multi-headed attention
          node_batch = nb(node_batch)
      for (
          eb
      ) in self.edge_blocks:  # bond messages. Multi-headed attention
          edge_batch = eb(edge_batch)
  
      (
          atom_output,
          _,
          _,
          _,
          _,
          _,
          _,
          _,
      ) = node_batch  # atom hidden states
      (
          _,
          bond_output,
          _,
          _,
          _,
          _,
          _,
          _,
      ) = edge_batch  # bond hidden states
  
      atom_embeddings = self._atom_bond_transform(
          to_atom=True,  # False: to bond
          atomwise_input=atom_output,
          bondwise_input=bond_output,
          original_f_atoms=original_f_atoms,
          original_f_bonds=original_f_bonds,
          a2a=a2a,
          a2b=a2b,
          b2a=b2a,
          b2revb=b2revb,
      )
  
      bond_embeddings = self._atom_bond_transform(
          to_atom=False,  # False: to bond
          atomwise_input=atom_output,
          bondwise_input=bond_output,
          original_f_atoms=original_f_atoms,
          original_f_bonds=original_f_bonds,
          a2a=a2a,
          a2b=a2b,
          b2a=b2a,
          b2revb=b2revb,
      )
  
      return (
          (atom_embeddings[0], bond_embeddings[0]),
          (atom_embeddings[1], bond_embeddings[1]),
      )
  
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 6 for calling the GroverTransEncoder obj's underlying member method code with example usage: obj.forward(batch) and returns: atom_embeddings,  bond_embeddings,  atom_embeddings,  bond_embeddings