class_docstr: Given a latent variable generating a given adversarial sample, either inferred by an inverse GAN or randomly
  generated, the InverseGAN optimizes that latent variable to project a sample as close as possible to the adversarial
  sample without the adversarial noise.
class_docstr_tok: ["Given","a","latent","variable","generating","a","given","adversarial","sample",",","either","inferred","by","an","inverse","GAN","or","randomly","generated",",","the","InverseGAN","optimizes","that","latent","variable","to","project","a","sample","as","close","as","possible","to","the","adversarial","sample","without","the","adversarial","noise","."]
docstr: Given a encoding z, computes the loss between the projected sample and the original sample.
  
  :param z_encoding: The encoding z.
  :param image_adv: The adversarial image.
  :return: The loss value
docstr_tok: ["Given","a","encoding","z",",","computes","the","loss","between","the","projected","sample","and","the","original","sample",".",":","param","z_encoding",":","The","encoding","z.",":","param","image_adv",":","The","adversarial","image",".",":","return",":","The","loss","value"]
code: def compute_loss(
      self, z_encoding: np.ndarray, image_adv: np.ndarray
  ) -> np.ndarray:
      """
      Given a encoding z, computes the loss between the projected sample and the original sample.
  
      :param z_encoding: The encoding z.
      :param image_adv: The adversarial image.
      :return: The loss value
      """
      logging.info("Calculating Loss")
  
      loss = self.sess.run(
          self._loss,
          feed_dict={
              self.gan.input_ph: z_encoding,
              self._image_adv: image_adv,
          },
      )
      return loss
  
file_path: adversarial-robustness-toolbox/art/defences/preprocessor/inverse_gan.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import Optional, Tuple, TYPE_CHECKING
  import numpy
  from scipy.optimize import minimize
  from art.defences.preprocessor.preprocessor import Preprocessor
label_desc: Use image node_id 3 for calling the InverseGAN obj's underlying member method code with example usage: obj.compute_loss(z_encoding, image_adv) and returns: loss