class_docstr: Implementation of Randomized Smoothing applied to classifier predictions and gradients, as introduced
  in Cohen et al. (2019).
  
  | Paper link: https://arxiv.org/abs/1902.02918
class_docstr_tok: ["Implementation","of","Randomized","Smoothing","applied","to","classifier","predictions","and","gradients",",","as","introduced","in","Cohen","et","al",".","(","2019",")",".","|","Paper","link",":","https",":","\/\/arxiv.org\/abs\/1902.02918"]
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': the sum of the output will be divided by the number of elements in the output,
                    'sum': the output will be summed.
  :param training_mode: `True` for model set to training mode and `'False` for model set to evaluation mode.
  :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","'",":","the","sum","of","the","output","will","be","divided","by","the","number","of","elements","in","the","output",",","'sum","'",":","the","output","will","be","summed",".",":","param","training_mode",":","`","True","`","for","model","set","to","training","mode","and","`","'False","`","for","model","set","to","evaluation","mode",".",":","return",":","Loss","values",".",":","rtype",":","Format","as","expected","by","the","`","model","`"]
code: def compute_loss(
      self,
      x: np.ndarray,
      y: np.ndarray,
      reduction: str = "none",
      training_mode: bool = False,
      **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': the sum of the output will be divided by the number of elements in the output,
                        'sum': the output will be summed.
      :param training_mode: `True` for model set to training mode and `'False` for model set to evaluation mode.
      :return: Loss values.
      :rtype: Format as expected by the `model`
      """
      raise NotImplementedError
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import Callable, List, Optional, Tuple, Union, TYPE_CHECKING
  import warnings
  from tqdm.auto import trange
  import numpy
  from art.estimators.classification.tensorflow import TensorFlowV2Classifier
  from art.estimators.certification.randomized_smoothing.randomized_smoothing import RandomizedSmoothingMixin
  from art.utils import check_and_transform_label_format
label_desc: Use image node_id 8 for calling the TensorFlowV2RandomizedSmoothing obj's underlying member method code with example usage: obj.compute_loss(x, y, reduction, training_mode) without return types