code: def consistency_loss(
      Z_cf_pred: tf.Tensor,
      Z_cf_tgt: Union[np.ndarray, tf.Tensor],
      **kwargs,
  ):
      """
      Computes heterogeneous consistency loss.
  
      Parameters
      ----------
      Z_cf_pred
              Counterfactual embedding prediction.
      Z_cf_tgt
          Counterfactual embedding target.
  
      Returns
      -------
      Heterogeneous consistency loss.
      """
      # Compute consistency loss
      loss = tf.reduce_mean(tf.square(Z_cf_pred - Z_cf_tgt))
      return {"consistency_loss": loss}
  
file_path: alibi/alibi/explainers/backends/tensorflow/cfrl_tabular.py
imports: from typing import List, Dict, Union
  import numpy
  import tensorflow
  from alibi.explainers.backends.cfrl_tabular import split_ohe, generate_condition
  from alibi.explainers.backends.tensorflow.cfrl_base import get_actor, get_critic, get_optimizer, data_generator, encode, decode, generate_cf, update_actor_critic, add_noise, to_numpy, to_tensor, set_seed, save_model, load_model, initialize_optimizers, initialize_actor_critic
label_desc: Use image node_id 5 for calling a global function with example usage: consistency_loss(Z_cf_pred, Z_cf_tgt) and returns: dict