code: def testEvalOpAndFinalOp(self):
      checkpoint_dir = os.path.join(
          self.get_temp_dir(), "eval_ops_and_final_ops"
      )
  
      # Train a model for a single step to get a checkpoint.
      self._train_model(checkpoint_dir, num_steps=1)
      checkpoint_path = saver.latest_checkpoint(checkpoint_dir)
  
      # Create the model so we have something to restore.
      inputs = constant_op.constant(self._inputs, dtype=dtypes.float32)
      logistic_classifier(inputs)
  
      num_evals = 5
      final_increment = 9.0
  
      my_var = local_variable(0.0, name="MyVar")
      eval_ops = state_ops.assign_add(my_var, 1.0)
      final_ops = array_ops.identity(my_var) + final_increment
  
      final_hooks = [
          evaluation._StopAfterNEvalsHook(num_evals),
      ]
      initial_hooks = list(final_hooks)
      final_ops_values = evaluation._evaluate_once(
          checkpoint_path=checkpoint_path,
          eval_ops=eval_ops,
          final_ops={"value": final_ops},
          hooks=final_hooks,
      )
      self.assertEqual(
          final_ops_values["value"], num_evals + final_increment
      )
      self.assertEqual(initial_hooks, final_hooks)
  
imports: import os
  import numpy
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import random_seed
  from tensorflow.python.layers import layers
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import metrics
  from tensorflow.python.ops import state_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops.losses import losses
  from tensorflow.python.platform import test
  from tensorflow.python.training import basic_session_run_hooks
  from tensorflow.python.training import evaluation
  from tensorflow.python.training import gradient_descent
  from tensorflow.python.training import monitored_session
  from tensorflow.python.training import saver
  from tensorflow.python.training import training
label_desc: Use image node_id 5 for calling the EvaluateOnceTest obj's underlying member method code with example usage: obj.testEvalOpAndFinalOp() without return types