class_docstr: kws solver
class_docstr_tok: ["kws","solver"]
code: def get_train_hooks(self, labels, logits, alpha=None):
      nclass = self.config["data"]["task"]["classes"]["num"]
      metric_tensor = {
          "global_step": tf.train.get_or_create_global_step(),
          "batch_accuracy": metrics.accuracy(logits, labels),
          "batch_confusion": metrics.confusion_matrix(
              logits, labels, nclass
          ),
      }
      tf.summary.scalar(
          "batch_accuracy", metric_tensor["batch_accuracy"]
      )
  
      train_hooks = [
          tf.train.StepCounterHook(
              every_n_steps=500,
              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=1000,
              every_n_secs=None,
              at_end=False,
              formatter=None,
          ),
      ]
      return train_hooks
  
file_path: delta/delta/utils/solver/kws_solver.py
imports: import delta.compat
  from delta.utils import metrics
  from delta.utils.register import registers
  from delta.utils.solver.estimator_solver import EstimatorSolver
label_desc: Use image node_id 3 for calling the KwsSolver obj's underlying member method code with example usage: obj.get_train_hooks(labels, logits, alpha) and returns: train_hooks