class_docstr: Model for Graph Property Prediction.
  
  This model proceeds as follows:
  
  * Update node representations in graphs with a variant of GAT, where a
      linear additive form of attention is applied. Attention Weights are derived
      by concatenating the node and edge features for each bond.
  * Update node representations with multiple rounds of message passing.
  * For each layer has, residual connections with its previous layer.
  * The final molecular representation is computed by combining the representations
      of all nodes in the molecule.
  * Perform the final prediction using a linear layer
  
  Examples
  --------
  >>> import deepchem as dc
  >>> from deepchem.models import PagtnModel
  >>> # preparing dataset
  >>> smiles = ["C1CCC1", "CCC"]
  >>> labels = [0., 1.]
  >>> featurizer = dc.feat.PagtnMolGraphFeaturizer(max_length=5)
  >>> X = featurizer.featurize(smiles)
  >>> dataset = dc.data.NumpyDataset(X=X, y=labels)
  >>> # training model
  >>> model = PagtnModel(mode='classification', n_tasks=1,
  ...                    batch_size=16, learning_rate=0.001)
  >>> loss = model.fit(dataset, nb_epoch=5)
  
  References
  ----------
  .. [1] Benson Chen, Regina Barzilay, Tommi Jaakkola. "Path-Augmented
      Graph Transformer Network." arXiv:1905.12712
  
  Notes
  -----
  This class requires DGL (https://github.com/dmlc/dgl) and DGL-LifeSci
  (https://github.com/awslabs/dgl-lifesci) to be installed.
docstr: Parameters
  ----------
  n_tasks: int
      Number of tasks.
  number_atom_features : int
      Size for the input node features. Default to 94.
  number_bond_features : int
      Size for the input edge features. Default to 42.
  mode: str
      The model type, 'classification' or 'regression'. Default to 'regression'.
  n_classes: int
      The number of classes to predict per task
      (only used when ``mode`` is 'classification'). Default to 2.
  output_node_features : int
      Size for the output node features in PAGTN layers. Default to 256.
  hidden_features : int
      Size for the hidden node features in PAGTN layers. Default to 32.
  num_layers: int
      Number of graph neural network layers, i.e. number of rounds of message passing.
      Default to 2.
  num_heads : int
      Number of attention heads. Default to 1.
  dropout: float
      Dropout probability. Default to 0.1
  pool_mode : 'max' or 'mean' or 'sum'
      Whether to compute elementwise maximum, mean or sum of the node representations.
  kwargs
      This can include any keyword argument of TorchModel.
code: def __init__(
      self,
      n_tasks: int,
      number_atom_features: int = 94,
      number_bond_features: int = 42,
      mode: str = "regression",
      n_classes: int = 2,
      output_node_features: int = 256,
      hidden_features: int = 32,
      num_layers: int = 5,
      num_heads: int = 1,
      dropout: float = 0.1,
      pool_mode: str = "sum",
      **kwargs,
  ):
      """
      Parameters
      ----------
      n_tasks: int
          Number of tasks.
      number_atom_features : int
          Size for the input node features. Default to 94.
      number_bond_features : int
          Size for the input edge features. Default to 42.
      mode: str
          The model type, 'classification' or 'regression'. Default to 'regression'.
      n_classes: int
          The number of classes to predict per task
          (only used when ``mode`` is 'classification'). Default to 2.
      output_node_features : int
          Size for the output node features in PAGTN layers. Default to 256.
      hidden_features : int
          Size for the hidden node features in PAGTN layers. Default to 32.
      num_layers: int
          Number of graph neural network layers, i.e. number of rounds of message passing.
          Default to 2.
      num_heads : int
          Number of attention heads. Default to 1.
      dropout: float
          Dropout probability. Default to 0.1
      pool_mode : 'max' or 'mean' or 'sum'
          Whether to compute elementwise maximum, mean or sum of the node representations.
      kwargs
          This can include any keyword argument of TorchModel.
      """
      model = Pagtn(
          n_tasks=n_tasks,
          number_atom_features=number_atom_features,
          number_bond_features=number_bond_features,
          mode=mode,
          n_classes=n_classes,
          output_node_features=output_node_features,
          hidden_features=hidden_features,
          num_layers=num_layers,
          num_heads=num_heads,
          dropout=dropout,
          pool_mode=pool_mode,
      )
      if mode == "regression":
          loss: Loss = L2Loss()
          output_types = ["prediction"]
      else:
          loss = SparseSoftmaxCrossEntropy()
          output_types = ["prediction", "loss"]
      super(PagtnModel, self).__init__(
          model, loss=loss, output_types=output_types, **kwargs
      )
  
file_path: deepchem/deepchem/models/torch_models/pagtn.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 1 to create a new PagtnModel object from inherited base classes: TorchModel with example: obj = PagtnModel(n_tasks, number_atom_features, number_bond_features, mode, n_classes, output_node_features, hidden_features, num_layers, num_heads, dropout, pool_mode)