code: def __init__(
      self,
      session=None,
      dummy_tags=None,
      use_contrib=True,
      use_gpu_device=0,
  ):
      tf.disable_v2_behavior()
      tf.enable_v2_tensorshape()
  
      self.word_repr = None
      self.word_embeddings = None
      self.session = session
      self.session_created = False
      self.dummy_tags = dummy_tags or []
      self.use_contrib = use_contrib
      self.use_gpu_device = use_gpu_device
  
      if self.session is None:
          self.session_created = True
          self.session = tf.compat.v1.Session(
              config=tf.compat.v1.ConfigProto(
                  allow_soft_placement=True, log_device_placement=False
              )
          )
      with tf.compat.v1.device("/gpu:{}".format(self.use_gpu_device)):
          with tf.compat.v1.variable_scope("char_repr"):
              # shape = (batch size, sentence, word)
              self.char_ids = tf.compat.v1.placeholder(
                  tf.int32, shape=[None, None, None], name="char_ids"
              )
  
              # shape = (batch_size, sentence)
              self.word_lengths = tf.compat.v1.placeholder(
                  tf.int32, shape=[None, None], name="word_lengths"
              )
  
          with tf.compat.v1.variable_scope("word_repr"):
              # shape = (batch size)
              self.sentence_lengths = tf.compat.v1.placeholder(
                  tf.int32, shape=[None], name="sentence_lengths"
              )
  
          with tf.compat.v1.variable_scope("training", reuse=None):
              # shape = (batch, sentence)
              self.labels = tf.compat.v1.placeholder(
                  tf.int32, shape=[None, None], name="labels"
              )
  
              self.lr = tf.compat.v1.placeholder_with_default(
                  0.005, shape=(), name="lr"
              )
              self.dropout = tf.compat.v1.placeholder(
                  tf.float32, shape=(), name="dropout"
              )
  
      self._char_bilstm_added = False
      self._char_cnn_added = False
      self._word_embeddings_added = False
      self._context_added = False
      self._encode_added = False
  
imports: import math
  import random
  import sys
  import numpy
  import tensorflow
  from .sentence_grouper import SentenceGrouper
  from ..tf2contrib import *
label_desc: Use image node_id 1 to create a new NerModel object  with example: obj = NerModel(session, dummy_tags, use_contrib, use_gpu_device)