class_docstr: base class for classfication 
code: def get_train_hooks(self, labels, logits, alpha=None):
      nclass = self.config["data"]["task"]["classes"]["num"]
      metric_tensor = {
          "batch_accuracy": metrics_lib.accuracy(logits, labels),
          "global_step": tf.train.get_or_create_global_step(),
      }
      if nclass > 100:
          logging.info(
              "Too many classes, disable confusion matrix in train: %d"
              % (nclass)
          )
      else:
          metric_tensor[
              "batch_confusion"
          ] = metrics_lib.confusion_matrix(logits, labels, nclass)
      summary_lib.scalar(
          "batch_accuracy", metric_tensor["batch_accuracy"]
      )
      if alpha:
          metric_tensor.update({"alignment": alpha})
  
      # plot PR curve
      true_label_bool = tf.cast(labels, tf.bool)
      softmax = tf.nn.softmax(logits)
      pr_summary.op(
          name="pr_curve_train_batch",
          labels=true_label_bool,
          predictions=softmax[:, -1],
          num_thresholds=16,
          weights=None,
      )
  
      train_hooks = [
          tf.train.StepCounterHook(
              every_n_steps=100,
              every_n_secs=None,
              output_dir=None,
              summary_writer=None,
          ),
          tf.train.FinalOpsHook(
              final_ops=[tf.train.get_or_create_global_step()],
              final_ops_feed_dict=None,
          ),
          tf.train.LoggingTensorHook(
              tensors=metric_tensor,
              every_n_iter=100,
              every_n_secs=None,
              at_end=False,
              formatter=None,
          ),
      ]
      return train_hooks
  
imports: import os
  import re
  import functools
  import collections
  from absl import logging
  import delta.compat
  from tensorflow.python import debug
  from tensorflow.python.estimator.canned import metric_keys
  from tensorboard.plugins.pr_curve import summary
  from delta import utils
  from delta.utils.hparam import HParams
  from delta.utils import metrics
  from delta.utils import summary
  from delta.utils.register import registers
  from delta.utils.solver.base_solver import ABCEstimatorSolver
label_desc: Use image node_id 9 for calling the EstimatorSolver obj's underlying member method code with example usage: obj.get_train_hooks(labels, logits, alpha) and returns: train_hooks