code: def test_dmpnn_classification_single_task():
      """
      Test DMPNN class for classification mode with 1 task
      """
      try:
          from torch_geometric.data import Data, Batch
      except ModuleNotFoundError:
          raise ImportError(
              "This test requires PyTorch Geometric to be installed."
          )
  
      torch.manual_seed(0)
      from deepchem.models.torch_models.dmpnn import _MapperDMPNN, DMPNN
  
      # get data
      input_smile = "CC"
      feat = dc.feat.DMPNNFeaturizer(features_generators=["morgan"])
      graph = feat.featurize(input_smile)
  
      mapper = _MapperDMPNN(graph[0])
      (
          atom_features,
          f_ini_atoms_bonds,
          atom_to_incoming_bonds,
          mapping,
          global_features,
      ) = mapper.values
  
      atom_features = torch.from_numpy(atom_features).float()
      f_ini_atoms_bonds = torch.from_numpy(f_ini_atoms_bonds).float()
      atom_to_incoming_bonds = torch.from_numpy(atom_to_incoming_bonds)
      mapping = torch.from_numpy(mapping)
      global_features = torch.from_numpy(global_features).float()
  
      data = [
          Data(
              atom_features=atom_features,
              f_ini_atoms_bonds=f_ini_atoms_bonds,
              atom_to_incoming_bonds=atom_to_incoming_bonds,
              mapping=mapping,
              global_features=global_features,
          )
      ]
  
      # prepare batch (size 1)
      pyg_batch = Batch()
      pyg_batch = pyg_batch.from_data_list(data)
  
      # initialize the model
      number_of_tasks = 1
      number_of_classes = 2
      number_of_molecules = 1
      morgan_feature_size = 2048
      model = DMPNN(
          mode="classification",
          n_classes=number_of_classes,
          global_features_size=morgan_feature_size,
          n_tasks=number_of_tasks,
      )
  
      assert (
          model.encoder.__repr__()
          == "DMPNNEncoderLayer(\n  (activation): ReLU()\n  (dropout): Dropout(p=0.0, inplace=False)\n  (W_i): Linear(in_features=147, out_features=300, bias=False)\n  (W_h): Linear(in_features=300, out_features=300, bias=False)\n"
          "  (W_o): Linear(in_features=433, out_features=300, bias=True)\n)"
      )
      assert (
          model.ffn.__repr__()
          == "PositionwiseFeedForward(\n  (activation): ReLU()\n  (linears): ModuleList(\n    (0): Linear(in_features=2348, out_features=300, bias=True)\n    (1): Linear(in_features=300, out_features=300, bias=True)\n    "
          "(2): Linear(in_features=300, out_features=2, bias=True)\n  )\n  (dropout_p): ModuleList(\n    (0-2): 3 x Dropout(p=0.0, inplace=False)\n  )\n)"
      )
  
      # get output
      output = model(pyg_batch)
      assert len(output) == 2
      assert output[0].shape == torch.Size(
          [number_of_molecules, number_of_classes]
      )
      assert output[1].shape == torch.Size(
          [number_of_molecules, number_of_classes]
      )
  
      required_output = torch.tensor([[0.5154, 0.4846]]), torch.tensor(
          [[0.0044, -0.0572]]
      )
      assert torch.allclose(output[0][0], required_output[0], atol=1e-4)
      assert torch.allclose(output[1][0], required_output[1], atol=1e-4)
  
file_path: deepchem/deepchem/models/tests/test_dmpnn.py
imports: import pytest
  import deepchem
  import tempfile
  import numpy
  import os
label_desc: Use image node_id 2 for calling a global function with example usage: test_dmpnn_classification_single_task() without return types