code: def _write_tb(
      self, lam, lam_lb, lam_ub, cf_found, X_current, **kwargs
  ):
      if self.model:
          scalars_tf = [
              self.global_step,
              self.learning_rate,
              self.dist[0],
              self.loss_pred[0],
              self.loss_opt[0],
              self.pred_proba_class[0],
          ]
          gs, lr, dist, loss_pred, loss_opt, pred = self.sess.run(
              scalars_tf, feed_dict={self.lam: lam}
          )
      else:
          scalars_tf = [
              self.global_step,
              self.learning_rate,
              self.dist[0],
              self.loss_opt[0],
          ]
          gs, lr, dist, loss_opt = self.sess.run(
              scalars_tf, feed_dict={self.lam: lam}
          )
          loss_pred = kwargs["loss_pred"]
          pred = kwargs["pred"]
  
      try:
          found = kwargs["found"]
          not_found = kwargs["not_found"]
      except KeyError:
          found = 0
          not_found = 0
  
      summary = tf.Summary()
      summary.value.add(tag="lr/global_step", simple_value=gs)
      summary.value.add(tag="lr/lr", simple_value=lr)
  
      summary.value.add(tag="lambda/lambda", simple_value=lam[0])
      summary.value.add(tag="lambda/l_bound", simple_value=lam_lb[0])
      summary.value.add(tag="lambda/u_bound", simple_value=lam_ub[0])
  
      summary.value.add(tag="losses/dist", simple_value=dist)
      summary.value.add(tag="losses/loss_pred", simple_value=loss_pred)
      summary.value.add(tag="losses/loss_opt", simple_value=loss_opt)
      summary.value.add(
          tag="losses/pred_div_dist",
          simple_value=loss_pred / (lam[0] * dist),
      )
  
      summary.value.add(tag="Y/pred_proba_class", simple_value=pred)
      summary.value.add(
          tag="Y/pred_class_fn(X_current)",
          simple_value=self.predict_class_fn(X_current),
      )
      summary.value.add(
          tag="Y/n_cf_found", simple_value=cf_found[0].sum()
      )
      summary.value.add(tag="Y/found", simple_value=found)
      summary.value.add(tag="Y/not_found", simple_value=not_found)
  
      self.writer.add_summary(summary)
      self.writer.flush()
  
imports: import copy
  import logging
  from typing import Callable, Optional, Tuple, Union
  import numpy
  import tensorflow.compat.v1
  from alibi.api.defaults import DEFAULT_DATA_CF, DEFAULT_META_CF
  from alibi.api.interfaces import Explainer, Explanation
  from alibi.utils.gradients import num_grad_batch
label_desc: Use image node_id 7 for calling the Counterfactual obj's underlying member method code with example usage: obj._write_tb(lam, lam_lb, lam_ub, cf_found, X_current) without return types