code: def _update_exp(self, i, l_step, lam, cf_found, X_current):
      cf_found[0][l_step] += 1  # TODO: batch support
      dist = self.sess.run(self.dist).item()
  
      # populate the return dict
      self.instance_dict["X"] = X_current
      self.instance_dict["distance"] = dist
      self.instance_dict["lambda"] = lam[0]
      self.instance_dict["index"] = l_step * self.max_iter + i
  
      preds = self.predict_fn(X_current)
      pred_class = preds.argmax()
      proba = preds.max()
      self.instance_dict["class"] = pred_class
      self.instance_dict["proba"] = preds
  
      self.instance_dict["loss"] = (
          proba - self.target_proba_arr[0]
      ) ** 2 + lam[0] * dist
  
      self.return_dict["all"][l_step].append(self.instance_dict.copy())
  
      # update best CF if it has a smaller distance
      if self.return_dict["cf"] is None:
          self.return_dict["cf"] = self.instance_dict.copy()
  
      elif dist < self.return_dict["cf"]["distance"]:
          self.return_dict["cf"] = self.instance_dict.copy()
  
      logger.debug("CF found at step %s", l_step * self.max_iter + i)
  
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 6 for calling the Counterfactual obj's underlying member method code with example usage: obj._update_exp(i, l_step, lam, cf_found, X_current) without return types