code: def __init__(self, config: DPRConfig, **kwargs):
      super().__init__(**kwargs)
  
      # resolve name conflict with TFBertMainLayer instead of TFBertModel
      self.bert_model = TFBertMainLayer(
          config, add_pooling_layer=False, name="bert_model"
      )
      self.config = config
  
      if self.config.hidden_size <= 0:
          raise ValueError("Encoder hidden_size can't be zero")
      self.projection_dim = config.projection_dim
      if self.projection_dim > 0:
          self.encode_proj = tf.keras.layers.Dense(
              config.projection_dim,
              kernel_initializer=get_initializer(
                  config.initializer_range
              ),
              name="encode_proj",
          )
  
imports: from __future__ import annotations
  from dataclasses import dataclass
  from typing import Tuple, Union
  import tensorflow
  from ...modeling_tf_outputs import TFBaseModelOutputWithPooling
  from ...modeling_tf_utils import TFModelInputType, TFPreTrainedModel, get_initializer, shape_list, unpack_inputs
  from ...utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from ..bert.modeling_tf_bert import TFBertMainLayer
  from .configuration_dpr import DPRConfig
label_desc: Use image node_id 1 to create a new TFDPREncoderLayer object from inherited base classes: tf.keras.layers with example: obj = TFDPREncoderLayer(config)