code: def _evaluate(self, session):
      try:
          with tf.Graph().as_default():
              from finetune import Classifier
  
              model = Classifier(**self._config_to_finetune)
  
              if self._current_finetune.saver.variables:
                  model.saver.variables = {
                      k: v.copy()
                      for k, v in self._current_finetune.saver.variables.items()
                      if "global_step" not in k and "Adam" not in k
                  }
  
              model.saver.fallback_ = {
                  k: v
                  for k, v in self._current_finetune.saver.fallback.items()
                  if "global_step" not in k
              }
              train_x, train_y = self.train_data
              model.fit(train_x, train_y)
              test_x, test_y = self.test_data
              test_accuracy = np.mean(model.predict(test_x) == test_y)
              train_accuracy = np.mean(
                  model.predict(train_x) == train_y
              )
      except IOError as e:
          traceback.print_exc(file=sys.stdout)
          test_accuracy = -1.0
          train_accuracy = -1.0
  
      global_step = session.run(
          tf.compat.v1.train.get_or_create_global_step()
      )
      directory = os.path.join(self._eval_dir, "..", "finetuning")
  
      if not os.path.exists(directory):
          os.makedirs(directory)
      summary_writer = writer_cache.FileWriterCache.get(directory)
      summary_proto = summary_pb2.Summary()
      summary_proto.value.add(
          tag="finetuning/{}_train_accurary".format(self._name),
          simple_value=float(train_accuracy),
      )
      summary_proto.value.add(
          tag="finetuning/{}_test_accurary".format(self._name),
          simple_value=float(test_accuracy),
      )
      summary_writer.add_summary(summary_proto, global_step)
      summary_writer.flush()
  
      self._timer.update_last_triggered_step(self._iter_count)
  
file_path: finetune/finetune/util/in_memory_finetune.py
imports: import os
  import traceback
  import sys
  from tensorflow.core.framework import summary_pb2
  from tensorflow.python.summary.writer import writer_cache
  import tensorflow
  import numpy
label_desc: Use image node_id 4 for calling the InMemoryFinetune obj's underlying member method code with example usage: obj._evaluate(session) without return types