class_docstr: Model for Graph Property Prediction.
  
  This model proceeds as follows:
  
  * Combine node features and edge features for initializing node representations,
      which involves a round of message passing
  * Update node representations with multiple rounds of message passing
  * For each graph, compute its representation by combining the representations
      of all nodes in it, which involves a gated recurrent unit (GRU).
  * Perform the final prediction using a linear layer
  
  Examples
  --------
  >>> import deepchem as dc
  >>> from deepchem.models import AttentiveFPModel
  >>> # preparing dataset
  >>> smiles = ["C1CCC1", "C1=CC=CN=C1"]
  >>> labels = [0., 1.]
  >>> featurizer = dc.feat.MolGraphConvFeaturizer(use_edges=True)
  >>> X = featurizer.featurize(smiles)
  >>> dataset = dc.data.NumpyDataset(X=X, y=labels)
  >>> # training model
  >>> model = AttentiveFPModel(mode='classification', n_tasks=1,
  ...    batch_size=16, learning_rate=0.001)
  >>> loss = model.fit(dataset, nb_epoch=5)
  
  References
  ----------
  .. [1] Zhaoping Xiong, Dingyan Wang, Xiaohong Liu, Feisheng Zhong, Xiaozhe Wan, Xutong Li,
      Zhaojun Li, Xiaomin Luo, Kaixian Chen, Hualiang Jiang, and Mingyue Zheng. "Pushing
      the Boundaries of Molecular Representation for Drug Discovery with the Graph
      Attention Mechanism." Journal of Medicinal Chemistry. 2020, 63, 16, 8749–8760.
  
  Notes
  -----
  This class requires DGL (https://github.com/dmlc/dgl) and DGL-LifeSci
  (https://github.com/awslabs/dgl-lifesci) to be installed.
docstr: Create batch data for AttentiveFP.
  
  Parameters
  ----------
  batch: tuple
      The tuple is ``(inputs, labels, weights)``.
  
  Returns
  -------
  inputs: DGLGraph
      DGLGraph for a batch of graphs.
  labels: list of torch.Tensor or None
      The graph labels.
  weights: list of torch.Tensor or None
      The weights for each sample or sample/task pair converted to torch.Tensor.
code: def _prepare_batch(self, batch):
      """Create batch data for AttentiveFP.
  
      Parameters
      ----------
      batch: tuple
          The tuple is ``(inputs, labels, weights)``.
  
      Returns
      -------
      inputs: DGLGraph
          DGLGraph for a batch of graphs.
      labels: list of torch.Tensor or None
          The graph labels.
      weights: list of torch.Tensor or None
          The weights for each sample or sample/task pair converted to torch.Tensor.
      """
      try:
          import dgl
      except:
          raise ImportError("This class requires dgl.")
  
      inputs, labels, weights = batch
      dgl_graphs = [
          graph.to_dgl_graph(self_loop=self._self_loop)
          for graph in inputs[0]
      ]
      inputs = dgl.batch(dgl_graphs).to(self.device)
      _, labels, weights = super(AttentiveFPModel, self)._prepare_batch(
          ([], labels, weights)
      )
      return inputs, labels, weights
  
file_path: deepchem/deepchem/models/torch_models/attentivefp.py
imports: import torch.nn
  import torch.nn.functional
  from deepchem.models.losses import Loss, L2Loss, SparseSoftmaxCrossEntropy
  from deepchem.models.torch_models.torch_model import TorchModel
label_desc: Use image node_id 2 for calling the AttentiveFPModel obj's underlying member method code with example usage: obj._prepare_batch(batch) and returns: inputs,  labels,  weights