code: def testGroverMPNEncoder(
      grover_batched_graph, dynamic_depth, atom_messages
  ):
      from deepchem.models.torch_models.grover_layers import (
          GroverMPNEncoder,
      )
  
      (
          f_atoms,
          f_bonds,
          a2b,
          b2a,
          b2revb,
          a2a,
          _,
          _,
          _,
      ) = grover_batched_graph.get_components()
  
      # TODO Write tests for undirected = True case, currently fails. for this case, we have
      # to generate inputs (a2b, b2a, b2revb) for undirected graph.
      hidden_size = 32
      depth = 5
      undirected = False
      attach_feats = True
      if not atom_messages:
          init_message_dim = f_bonds.shape[1]
          attached_feat_fdim = f_atoms.shape[1]
          layer = GroverMPNEncoder(
              atom_messages=atom_messages,
              init_message_dim=init_message_dim,
              attached_feat_fdim=attached_feat_fdim,
              hidden_size=hidden_size,
              depth=depth,
              dynamic_depth=dynamic_depth,
              undirected=undirected,
              attach_feats=attach_feats,
          )
          init_messages = f_bonds
          init_attached_features = f_atoms
          a2nei = a2b
          a2attached = a2a
          out = layer(
              init_messages,
              init_attached_features,
              a2nei,
              a2attached,
              b2a,
              b2revb,
          )
          assert out.shape == (f_bonds.shape[0], hidden_size)
      else:
          init_message_dim = f_atoms.shape[1]
          attached_feat_fdim = f_bonds.shape[1]
  
          layer = GroverMPNEncoder(
              atom_messages=atom_messages,
              init_message_dim=init_message_dim,
              attached_feat_fdim=attached_feat_fdim,
              hidden_size=hidden_size,
              depth=depth,
              dynamic_depth=dynamic_depth,
              undirected=undirected,
              attach_feats=attach_feats,
          )
          init_attached_features = f_bonds
          init_messages = f_atoms
          a2nei = a2a
          a2attached = a2b
          out = layer(
              init_messages,
              init_attached_features,
              a2nei,
              a2attached,
              b2a,
              b2revb,
          )
          assert out.shape == (f_atoms.shape[0], hidden_size)
  
file_path: deepchem/deepchem/models/torch_models/tests/test_grover_layers.py
imports: import pytest
label_desc: Use image node_id 5 for calling a global function with example usage: testGroverMPNEncoder(grover_batched_graph, dynamic_depth, atom_messages) without return types