docstr: An internal keras model class.
  
  The graph convolutions use a nonstandard control flow so the
  standard Keras functional API can't support them. We instead
  use the imperative "subclassing" API to implement the graph
  convolutions.
  
  All arguments have the same meaning as in GraphConvModel.
docstr_tok: ["An","internal","keras","model","class",".","The","graph","convolutions","use","a","nonstandard","control","flow","so","the","standard","Keras","functional","API","ca","n't","support","them",".","We","instead","use","the","imperative","``","subclassing","''","API","to","implement","the","graph","convolutions",".","All","arguments","have","the","same","meaning","as","in","GraphConvModel","."]
code: def __init__(
      self,
      n_tasks,
      graph_conv_layers,
      dense_layer_size=128,
      dropout=0.0,
      mode="classification",
      number_atom_features=75,
      n_classes=2,
      batch_normalize=True,
      uncertainty=False,
      batch_size=100,
  ):
      """An internal keras model class.
  
      The graph convolutions use a nonstandard control flow so the
      standard Keras functional API can't support them. We instead
      use the imperative "subclassing" API to implement the graph
      convolutions.
  
      All arguments have the same meaning as in GraphConvModel.
      """
      super(_GraphConvKerasModel, self).__init__()
      if mode not in ["classification", "regression"]:
          raise ValueError(
              "mode must be either 'classification' or 'regression'"
          )
  
      self.mode = mode
      self.uncertainty = uncertainty
  
      if not isinstance(dropout, SequenceCollection):
          dropout = [dropout] * (len(graph_conv_layers) + 1)
      if len(dropout) != len(graph_conv_layers) + 1:
          raise ValueError(
              "Wrong number of dropout probabilities provided"
          )
      if uncertainty:
          if mode != "regression":
              raise ValueError(
                  "Uncertainty is only supported in regression mode"
              )
          if any(d == 0.0 for d in dropout):
              raise ValueError(
                  "Dropout must be included in every layer to predict uncertainty"
              )
  
      self.graph_convs = [
          layers.GraphConv(layer_size, activation_fn=tf.nn.relu)
          for layer_size in graph_conv_layers
      ]
      self.batch_norms = [
          BatchNormalization(fused=False) if batch_normalize else None
          for _ in range(len(graph_conv_layers) + 1)
      ]
      self.dropouts = [
          Dropout(rate=rate) if rate > 0.0 else None for rate in dropout
      ]
      self.graph_pools = [layers.GraphPool() for _ in graph_conv_layers]
      self.dense = Dense(dense_layer_size, activation=tf.nn.relu)
      self.graph_gather = layers.GraphGather(
          batch_size=batch_size, activation_fn=tf.nn.tanh
      )
      self.trim = TrimGraphOutput()
      if self.mode == "classification":
          self.reshape_dense = Dense(n_tasks * n_classes)
          self.reshape = Reshape((n_tasks, n_classes))
          self.softmax = Softmax()
      else:
          self.regression_dense = Dense(n_tasks)
          if self.uncertainty:
              self.uncertainty_dense = Dense(n_tasks)
              self.uncertainty_trim = TrimGraphOutput()
              self.uncertainty_activation = Activation(tf.exp)
  
imports: from collections.abc import Sequence
  import deepchem
  import numpy
  import tensorflow
  from typing import List, Union, Tuple, Iterable, Dict, Optional
  from deepchem.utils.typing import OneOrMany, LossFn, ActivationFn
  from deepchem.data import Dataset, pad_features
  from deepchem.feat.mol_graphs import ConvMol
  from deepchem.metrics import to_one_hot
  from deepchem.models import KerasModel, layers
  from deepchem.models.losses import L2Loss, SoftmaxCrossEntropy, Loss
  from tensorflow.keras.layers import Input, Dense, Reshape, Softmax, Dropout, Activation, BatchNormalization
  import warnings
label_desc: Use image node_id 1 to create a new _GraphConvKerasModel object from inherited base classes: tf.keras with example: obj = _GraphConvKerasModel(n_tasks, graph_conv_layers, dense_layer_size, dropout, mode, number_atom_features, n_classes, batch_normalize, uncertainty, batch_size)