code: def get_loss_vat(
      inputs,
      predictions,
      mask,
      is_train,
      model,
      placeholders,
      predictions_var_scope,
  ):
      """Computes the virtual adversarial loss for the provided inputs.
  
      Args:
        inputs: A batch of input features, where the batch is the first dimension.
        predictions: The logits predicted by a model on the provided inputs.
        mask: A tensor of booleans specifying which samples to apply the virtual
          adversarial loss to.
        is_train: A boolean placeholder specifying if this is a training or testing
          setting.
        model: The model that generated the logits.
        placeholders: Placeholders for model encodings.
        predictions_var_scope: Variable scope for obtaining the predictions.
  
      Returns:
        A float value representing the virtual adversarial loss.
      """
      mask = tf.cast(mask, dtype=tf.float32)
      r_vadv = generate_virtual_adversarial_perturbation(
          inputs,
          predictions,
          model,
          placeholders,
          mask,
          predictions_var_scope,
          is_train=is_train,
      )
      predictions = tf.stop_gradient(predictions)
      logit_p = predictions
      new_inputs = tf.sparse_add(inputs, r_vadv)
      with tf.variable_scope(
          predictions_var_scope, auxiliary_name_scope=False, reuse=True
      ):
          encoding_m, _, _ = model.get_encoding_and_params(
              inputs=new_inputs,
              is_train=is_train,
              update_batch_stats=False,
              **placeholders,
          )
          logit_m, _, _ = model.get_predictions_and_params(
              encoding=encoding_m, is_train=is_train, **placeholders
          )
      num_non_zero = tf.reduce_sum(mask)
      loss = kl_divergence_with_logit(logit_p, logit_m, mask)
      return tf.reduce_sum(loss) / num_non_zero
  
file_path: neural-structured-learning/research/gam/gam/trainer/adversarial_sparse.py
imports: from .adversarial_dense import get_normalized_vector
  from .adversarial_dense import get_normalizing_constant
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: get_loss_vat(inputs, predictions, mask, is_train, model, placeholders, predictions_var_scope) and returns: unknown