code: def _eval(sess, epoch, data_tag):
      fetches = {
          "predicts": predicts,
      }
      mode = tf.estimator.ModeKeys.EVAL
      file_name = "tmp/%s%d" % (data_tag, epoch)
      writer = CoNLLWriter(i2w, i2n)
      writer.start(file_name)
      data = data_dev if data_tag == "dev" else data_test
      for batch in iterate_batch(
          data, config.batch_size, shuffle=False
      ):
          word, char, ner, mask, length = batch
          feed_dict = {
              inputs: word,
              chars: char,
              targets: ner,
              masks: mask,
              seq_lengths: length,
              global_step: epoch,
              tx.global_mode(): mode,
          }
          rets = sess.run(fetches, feed_dict)
          predictions = rets["predicts"]
          writer.write(word, predictions, ner, length)
      writer.close()
      acc, precision, recall, f1 = scores.scores(file_name)
      print(
          "%s acc: %.2f%%, precision: %.2f%%, recall: %.2f%%, F1: %.2f%%"
          % (data_tag, acc, precision, recall, f1)
      )
      return acc, precision, recall, f1
  
file_path: texar/examples/sequence_tagging/ner.py
imports: import os
  import time
  import importlib
  import numpy
  import tensorflow
  import texar.tf
  from examples.sequence_tagging.conll_reader import create_vocabs, read_data, iterate_batch, load_glove, construct_init_word_vecs
  from examples.sequence_tagging.conll_writer import CoNLLWriter
  from examples.sequence_tagging import scores
label_desc: Use image node_id 2 for calling a global function with example usage: _eval(sess, epoch, data_tag) and returns: acc,  precision,  recall,  f1