class_docstr: Performs Message Passing to generate encodings for the molecule.
  
  Parameters
  ----------
  atom_messages: bool
      True if encoding atom-messages else False.
  init_message_dim: int
      Dimension of embedding message.
  attach_feats: bool
      Set to `True` if additional features are passed along with node/edge embeddings.
  attached_feat_fdim: int
      Dimension of additional features when `attach_feats` is `True`
  undirected: bool
      If set to `True`, the graph is considered as an undirected graph.
  depth: int
      number of hops in a message passing iteration
  dynamic_depth: str, default: none
      If set to `uniform` for randomly sampling dynamic depth from an uniform distribution else if set to `truncnorm`, dynamic depth is sampled from a truncated normal distribution.
  input_layer: str
      If set to `fc`, adds an initial feed-forward layer. If set to `none`, does not add an initial feed forward layer.
class_docstr_tok: ["Performs","Message","Passing","to","generate","encodings","for","the","molecule",".","Parameters","--","--","--","--","--","atom_messages",":","bool","True","if","encoding","atom-messages","else","False",".","init_message_dim",":","int","Dimension","of","embedding","message",".","attach_feats",":","bool","Set","to","`","True","`","if","additional","features","are","passed","along","with","node\/edge","embeddings",".","attached_feat_fdim",":","int","Dimension","of","additional","features","when","`","attach_feats","`","is","`","True","`","undirected",":","bool","If","set","to","`","True","`",",","the","graph","is","considered","as","an","undirected","graph",".","depth",":","int","number","of","hops","in","a","message","passing","iteration","dynamic_depth",":","str",",","default",":","none","If","set","to","`","uniform","`","for","randomly","sampling","dynamic","depth","from","an","uniform","distribution","else","if","set","to","`","truncnorm","`",",","dynamic","depth","is","sampled","from","a","truncated","normal","distribution",".","input_layer",":","str","If","set","to","`","fc","`",",","adds","an","initial","feed-forward","layer",".","If","set","to","`","none","`",",","does","not","add","an","initial","feed","forward","layer","."]
code: def __init__(
      self,
      atom_messages: bool,
      init_message_dim: int,
      hidden_size: int,
      depth: int,
      undirected: bool,
      attach_feats: bool,
      attached_feat_fdim: int = 0,
      bias: bool = True,
      dropout: float = 0.2,
      activation: str = "relu",
      input_layer: str = "fc",
      dynamic_depth: str = "none",
  ):
      super(GroverMPNEncoder, self).__init__()
      if input_layer == "none":
          assert init_message_dim == hidden_size
      assert dynamic_depth in [
          "uniform",
          "truncnorm",
          "none",
      ], "dynamic depth should be one of uniform, truncnorm, none"
      self.init_message_dim = init_message_dim
      self.depth = depth
      self.input_layer = input_layer
      self.layers_per_message = 1
      self.undirected = undirected
      self.atom_messages = atom_messages
      self.attached_feat = attach_feats
  
      assert dynamic_depth in [
          "none",
          "truncnorm",
          "uniform",
      ], "If dynamic depth, it should be truncnorm or uniform"
      self.dynamic_depth = dynamic_depth
  
      self.dropout_layer = nn.Dropout(p=dropout)
      if activation == "relu":
          self.act_func = nn.ReLU()
      else:
          raise ValueError("Only ReLU activation function is supported")
  
      if self.input_layer == "fc":
          self.W_i = nn.Linear(
              self.init_message_dim, hidden_size, bias=bias
          )
          w_h_input_size = hidden_size
      elif input_layer == "none":
          w_h_input_size = self.init_message_dim
  
      if self.attached_feat:
          w_h_input_size += attached_feat_fdim
  
      # Shared weight matrix across depths (default)
      self.W_h = nn.Linear(w_h_input_size, hidden_size, bias=bias)
  
imports: from typing import List, Dict
  import numpy
  from scipy import stats
  from deepchem.models.torch_models.readout import GroverReadout
  from deepchem.models.torch_models.layers import SublayerConnection, PositionwiseFeedForward
label_desc: Use image node_id 1 to create a new GroverMPNEncoder object from inherited base classes: nn with example: obj = GroverMPNEncoder(atom_messages, init_message_dim, hidden_size, depth, undirected, attach_feats, attached_feat_fdim, bias, dropout, activation, input_layer, dynamic_depth)