class_docstr: kws solver
class_docstr_tok: ["kws","solver"]
docstr: lables: [batch]
  logits: [batch, num_classes]
docstr_tok: ["lables",":","[","batch","]","logits",":","[","batch",",","num_classes","]"]
code: def get_eval_hooks(self, labels, logits):
      """lables: [batch]
      logits: [batch, num_classes]
      """
      eval_hooks = []
      metric_tensor = {}
      with tf.variable_scope("metrics"):
          true_label = labels
          softmax = tf.nn.softmax(logits)
          pred_label = tf.argmax(softmax, -1)
          eval_metrics_ops = {
              "accuracy": tf.metrics.accuracy(
                  labels=true_label,
                  predictions=pred_label,
                  weights=None,
              ),
              "auc": tf.metrics.auc(
                  labels=true_label,
                  predictions=softmax[:, -1],
                  num_thresholds=20,
                  curve="ROC",
                  summation_method="trapezoidal",
              ),
              "precision": tf.metrics.precision(
                  labels=true_label,
                  predictions=pred_label,
                  weights=None,
              ),
              "recall": tf.metrics.recall(
                  labels=true_label,
                  predictions=pred_label,
                  weights=None,
              ),
              "tp": tf.metrics.true_positives(
                  labels=true_label,
                  predictions=pred_label,
                  weights=None,
              ),
              "fn": tf.metrics.false_negatives(
                  labels=true_label,
                  predictions=pred_label,
                  weights=None,
              ),
              "fp": tf.metrics.false_positives(
                  labels=true_label,
                  predictions=pred_label,
                  weights=None,
              ),
              "tn": tf.metrics.true_negatives(
                  labels=true_label,
                  predictions=pred_label,
                  weights=None,
              ),
          }
  
      metric_tensor.update(
          {key: val[0] for key, val in eval_metrics_ops.items()}
      )
      metric_hook = tf.train.LoggingTensorHook(
          tensors=metric_tensor,
          every_n_iter=10000,
          every_n_secs=None,
          at_end=False,
          formatter=None,
      )
      eval_hooks.append(metric_hook)
      return eval_hooks, eval_metrics_ops
  
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 4 for calling the KwsSolver obj's underlying member method code with example usage: obj.get_eval_hooks(labels, logits) and returns: eval_hooks,  eval_metrics_ops