code: def _create_lstm_layer(self, inputs, hidden_size, lengths):
      with tf.compat.v1.device("/gpu:{}".format(self.use_gpu_device)):
          if not self.use_contrib:
              raise ValueError(
                  "NER Tensorflow graphs can no longer be built without tf.contrib. Set use_contrib=True."
              )
  
          time_based = tf.transpose(a=inputs, perm=[1, 0, 2])
  
          cell_fw = LSTMBlockFusedCell(hidden_size, use_peephole=True)
          cell_bw = LSTMBlockFusedCell(hidden_size, use_peephole=True)
          cell_bw = TimeReversedFusedRNN(cell_bw)
  
          output_fw, _ = cell_fw(
              time_based, dtype=tf.float32, sequence_length=lengths
          )
          output_bw, _ = cell_bw(
              time_based, dtype=tf.float32, sequence_length=lengths
          )
  
          result = tf.concat([output_fw, output_bw], axis=-1)
  
          return tf.transpose(a=result, perm=[1, 0, 2])
  
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 5 for calling the NerModel obj's underlying member method code with example usage: obj._create_lstm_layer(inputs, hidden_size, lengths) and returns: tf