class_docstr: This class implements a classifier with the TensorFlow framework.
class_docstr_tok: ["This","class","implements","a","classifier","with","the","TensorFlow","framework","."]
docstr: Compute the loss of the neural network for samples `x`.
  
  :param x: Samples of shape (nb_samples, nb_features) or (nb_samples, nb_pixels_1, nb_pixels_2,
            nb_channels) or (nb_samples, nb_channels, nb_pixels_1, nb_pixels_2).
  :param y: Target values (class labels) one-hot-encoded of shape `(nb_samples, nb_classes)` or indices
            of shape `(nb_samples,)`.
  :param reduction: Specifies the reduction to apply to the output: 'none' | 'mean' | 'sum'.
             'none': no reduction will be applied
             'mean': Not supported
             'sum': Not supported
  :return: Loss values.
  :rtype: Format as expected by the `model`
docstr_tok: ["Compute","the","loss","of","the","neural","network","for","samples","`","x","`",".",":","param","x",":","Samples","of","shape","(","nb_samples",",","nb_features",")","or","(","nb_samples",",","nb_pixels_1",",","nb_pixels_2",",","nb_channels",")","or","(","nb_samples",",","nb_channels",",","nb_pixels_1",",","nb_pixels_2",")",".",":","param","y",":","Target","values","(","class","labels",")","one-hot-encoded","of","shape","`","(","nb_samples",",","nb_classes",")","`","or","indices","of","shape","`","(","nb_samples",",",")","`",".",":","param","reduction",":","Specifies","the","reduction","to","apply","to","the","output",":","'none","'","|","'mean","'","|","'sum","'",".","'none","'",":","no","reduction","will","be","applied","'mean","'",":","Not","supported","'sum","'",":","Not","supported",":","return",":","Loss","values",".",":","rtype",":","Format","as","expected","by","the","`","model","`"]
code: def compute_loss(  # pylint: disable=W0221
      self,
      x: np.ndarray,
      y: np.ndarray,
      reduction: str = "none",
      **kwargs,
  ) -> np.ndarray:
      """
      Compute the loss of the neural network for samples `x`.
  
      :param x: Samples of shape (nb_samples, nb_features) or (nb_samples, nb_pixels_1, nb_pixels_2,
                nb_channels) or (nb_samples, nb_channels, nb_pixels_1, nb_pixels_2).
      :param y: Target values (class labels) one-hot-encoded of shape `(nb_samples, nb_classes)` or indices
                of shape `(nb_samples,)`.
      :param reduction: Specifies the reduction to apply to the output: 'none' | 'mean' | 'sum'.
                 'none': no reduction will be applied
                 'mean': Not supported
                 'sum': Not supported
      :return: Loss values.
      :rtype: Format as expected by the `model`
      """
      import tensorflow.compat.v1 as tf
  
      if self.learning is not None:
          self.feed_dict[self.learning] = False
  
      if self.loss is None:  # pragma: no cover
          raise TypeError(
              "The loss placeholder `loss` is required for computing losses, but it is not defined."
          )
  
      if reduction == "none":
          _loss = self._loss
      elif reduction == "mean":
          _loss = tf.reduce_mean(self._loss)
      elif reduction == "sum":
          _loss = tf.reduce_sum(self._loss)
      else:
          raise ValueError("Value of `reduction` not recognized.")
  
      # Apply preprocessing
      x_preprocessed, _ = self._apply_preprocessing(x, y, fit=False)
  
      # Create feed_dict
      feed_dict = {self.input_ph: x_preprocessed, self.labels_ph: y}
      feed_dict.update(self.feed_dict)
  
      # Run train step
      loss_value = self._sess.run(_loss, feed_dict=feed_dict)
  
      return loss_value
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import os
  import random
  import shutil
  import time
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union, TYPE_CHECKING
  from tqdm.auto import tqdm
  import numpy
  import six
  from art import config
  from art.estimators.classification.classifier import ClassGradientsMixin, ClassifierMixin
  from art.estimators.tensorflow import TensorFlowEstimator, TensorFlowV2Estimator
  from art.utils import check_and_transform_label_format
label_desc: Use image node_id 15 for calling the TensorFlowClassifier obj's underlying member method code with example usage: obj.compute_loss(x, y, reduction) and returns: loss_value