class_docstr: Classifier model based on a BERT-style transformer-based encoder.
  
  This is an implementation of the network structure surrounding a transformer
  encoder as described in "BERT: Pre-training of Deep Bidirectional Transformers
  for Language Understanding" (https://arxiv.org/abs/1810.04805).
  
  The BertClassifier allows a user to pass in a transformer stack, and
  instantiates a classification network based on the passed `num_classes`
  argument.
  
  Attributes:
    network: A transformer network. This network should output a sequence output
      and a classification output. Furthermore, it should expose its embedding
      table via a "get_embedding_table" method.
    num_classes: Number of classes to predict from the classification network.
    initializer: The initializer (if any) to use in the classification networks.
      Defaults to a Glorot uniform initializer.
    output: The output style for this network. Can be either 'logits' or
      'predictions'.
code: def __init__(
      self,
      network,
      num_classes,
      initializer="glorot_uniform",
      output="logits",
      dropout_rate=0.1,
      **kwargs,
  ):
      self._self_setattr_tracking = False
      self._config = {
          "network": network,
          "num_classes": num_classes,
          "initializer": initializer,
          "output": output,
      }
  
      # We want to use the inputs of the passed network as the inputs to this
      # Model. To do this, we need to keep a handle to the network inputs for use
      # when we construct the Model object at the end of init.
      inputs = network.inputs
  
      # Because we have a copy of inputs to create this Model object, we can
      # invoke the Network object with its own input tensors to start the
      # Model.
      _, cls_output = network(inputs)
      cls_output = tf.keras.layers.Dropout(rate=dropout_rate)(
          cls_output
      )
  
      self.classifier = networks.Classification(
          input_width=cls_output.shape[-1],
          num_classes=num_classes,
          initializer=initializer,
          output=output,
          name="classification",
      )
      predictions = self.classifier(cls_output)
  
      super(BertClassifier, self).__init__(
          inputs=inputs, outputs=predictions, **kwargs
      )
  
file_path: autodist/examples/benchmark/utils/modeling/networks/bert_classifier.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  from utils.modeling import networks
label_desc: Use image node_id 1 to create a new BertClassifier object from inherited base classes: tf.keras with example: obj = BertClassifier(network, num_classes, initializer, output, dropout_rate)