class_docstr: Principal Neighbourhood Aggregation Graph Neural Network [1]. This defines the message passing layers of the PNA model.
  
  Parameters
  ----------
  hidden_dim : int
      Dimension of the hidden layers.
  aggregators : List[str]
      List of aggregator functions to use.
  scalers : List[str]
      List of scaler functions to use. Options are "identity", "amplification", "attenuation".
  residual : bool, optional, default=True
      Whether to use residual connections.
  pairwise_distances : bool, optional, default=False
      Whether to use pairwise distances.
  activation : Union[Callable, str], optional, default="relu"
      Activation function to use.
  batch_norm : bool, optional, default=True
      Whether to use batch normalization in the layers before the aggregator.
  batch_norm_momentum : float, optional, default=0.1
      Momentum for the batch normalization layers.
  propagation_depth : int, optional, default=5
      Number of propagation layers.
  dropout : float, optional, default=0.0
      Dropout rate.
  posttrans_layers : int, optional, default=1
      Number of post-transformation layers.
  pretrans_layers : int, optional, default=1
      Number of pre-transformation layers.
  
  References
  ----------
  .. [1] Corso, G., Cavalleri, L., Beaini, D., Liò, P. & Veličković, P. Principal Neighbourhood Aggregation for Graph Nets. Preprint at https://doi.org/10.48550/arXiv.2004.05718 (2020).
  
  Examples
  --------
  >>> import numpy as np
  >>> from deepchem.feat.molecule_featurizers.conformer_featurizer import RDKitConformerFeaturizer
  >>> from deepchem.feat.graph_data import BatchGraphData
  >>> from deepchem.models.torch_models.pna_gnn import PNAGNN
  >>> featurizer = RDKitConformerFeaturizer(num_conformers=2)
  >>> smiles = ['C1=CC=NC=C1', 'CC(=O)C', 'C']
  >>> featurizer = RDKitConformerFeaturizer(num_conformers=2, rmsd_cutoff=1)
  >>> data = featurizer.featurize(smiles)
  >>> features = BatchGraphData(np.concatenate(data))
  >>> features = features.to_dgl_graph()
  >>> model = PNAGNN(hidden_dim=16,
  ...                aggregators=['mean', 'sum'],
  ...                scalers=['identity'])
  >>> output = model(features)
class_docstr_tok: ["Principal","Neighbourhood","Aggregation","Graph","Neural","Network","[","1","]",".","This","defines","the","message","passing","layers","of","the","PNA","model",".","Parameters","--","--","--","--","--","hidden_dim",":","int","Dimension","of","the","hidden","layers",".","aggregators",":","List","[","str","]","List","of","aggregator","functions","to","use",".","scalers",":","List","[","str","]","List","of","scaler","functions","to","use",".","Options","are","``","identity","''",",","``","amplification","''",",","``","attenuation","''",".","residual",":","bool",",","optional",",","default=True","Whether","to","use","residual","connections",".","pairwise_distances",":","bool",",","optional",",","default=False","Whether","to","use","pairwise","distances",".","activation",":","Union","[","Callable",",","str","]",",","optional",",","default=","''","relu","''","Activation","function","to","use",".","batch_norm",":","bool",",","optional",",","default=True","Whether","to","use","batch","normalization","in","the","layers","before","the","aggregator",".","batch_norm_momentum",":","float",",","optional",",","default=0.1","Momentum","for","the","batch","normalization","layers",".","propagation_depth",":","int",",","optional",",","default=5","Number","of","propagation","layers",".","dropout",":","float",",","optional",",","default=0.0","Dropout","rate",".","posttrans_layers",":","int",",","optional",",","default=1","Number","of","post-transformation","layers",".","pretrans_layers",":","int",",","optional",",","default=1","Number","of","pre-transformation","layers",".","References","--","--","--","--","--","..","[","1","]","Corso",",","G.",",","Cavalleri",",","L.",",","Beaini",",","D.",",","Li\u00f2",",","P.","&","Veli\u010dkovi\u0107",",","P.","Principal","Neighbourhood","Aggregation","for","Graph","Nets",".","Preprint","at","https",":","\/\/doi.org\/10.48550\/arXiv.2004.05718","(","2020",")",".","Examples","--","--","--","--",">",">",">","import","numpy","as","np",">",">",">","from","deepchem.feat.molecule_featurizers.conformer_featurizer","import","RDKitConformerFeaturizer",">",">",">","from","deepchem.feat.graph_data","import","BatchGraphData",">",">",">","from","deepchem.models.torch_models.pna_gnn","import","PNAGNN",">",">",">","featurizer","=","RDKitConformerFeaturizer","(","num_conformers=2",")",">",">",">","smiles","=","[","'C1=CC=NC=C1","'",",","'CC","(","=O",")","C","'",",","'","C","'","]",">",">",">","featurizer","=","RDKitConformerFeaturizer","(","num_conformers=2",",","rmsd_cutoff=1",")",">",">",">","data","=","featurizer.featurize","(","smiles",")",">",">",">","features","=","BatchGraphData","(","np.concatenate","(","data",")",")",">",">",">","features","=","features.to_dgl_graph","(",")",">",">",">","model","=","PNAGNN","(","hidden_dim=16",",","...","aggregators=","[","'mean","'",",","'sum","'","]",",","...","scalers=","[","'identity","'","]",")",">",">",">","output","=","model","(","features",")"]
code: def __init__(
      self,
      hidden_dim,
      aggregators: List[str],
      scalers: List[str],
      residual: bool = True,
      pairwise_distances: bool = False,
      activation: Union[Callable, str] = "relu",
      batch_norm: bool = True,
      batch_norm_momentum=0.1,
      propagation_depth: int = 5,
      dropout: float = 0.0,
      posttrans_layers: int = 1,
      pretrans_layers: int = 1,
      **kwargs,
  ):
      super(PNAGNN, self).__init__()
  
      self.mp_layers = nn.ModuleList()
  
      for _ in range(propagation_depth):
          self.mp_layers.append(
              PNALayer(
                  in_dim=hidden_dim,
                  out_dim=int(hidden_dim),
                  in_dim_edges=hidden_dim,
                  aggregators=aggregators,
                  scalers=scalers,
                  pairwise_distances=pairwise_distances,
                  residual=residual,
                  dropout=dropout,
                  activation=activation,
                  avg_d={"log": 1.0},
                  posttrans_layers=posttrans_layers,
                  pretrans_layers=pretrans_layers,
                  batch_norm=batch_norm,
                  batch_norm_momentum=batch_norm_momentum,
              ),
          )
      self.atom_encoder = AtomEncoder(emb_dim=hidden_dim)
      self.bond_encoder = BondEncoder(emb_dim=hidden_dim)
  
imports: from functools import partial
  from math import sqrt
  from typing import Callable, Dict, List, Union
  import dgl
  import torch
  from torch import nn
  import torch.nn.functional
  from deepchem.feat.molecule_featurizers.conformer_featurizer import full_atom_feature_dims, full_bond_feature_dims
  from deepchem.models.torch_models.layers import MultilayerPerceptron
  from deepchem.utils.graph_utils import aggregate_max, aggregate_mean, aggregate_min, aggregate_moment, aggregate_std, aggregate_sum, aggregate_var, scale_amplification, scale_attenuation, scale_identity
label_desc: Use image node_id 1 to create a new PNAGNN object from inherited base classes: nn with example: obj = PNAGNN(hidden_dim, aggregators, scalers, residual, pairwise_distances, activation, batch_norm, batch_norm_momentum, propagation_depth, dropout, posttrans_layers, pretrans_layers)