class_docstr: This class implements a Classifier extension that wraps a classifier and a detector.
  More details in https://arxiv.org/abs/1705.07263
class_docstr_tok: ["This","class","implements","a","Classifier","extension","that","wraps","a","classifier","and","a","detector",".","More","details","in","https",":","\/\/arxiv.org\/abs\/1705.07263"]
code: def _compute_combined_grads(
      self, x: np.ndarray, label: Optional[Union[int, List[int]]] = None
  ) -> np.ndarray:
      # Compute the classifier gradients
      classifier_grads = self.classifier.class_gradient(
          x=x, label=label
      )
  
      # Then compute the detector gradients
      detector_grads = self.detector.class_gradient(x=x, label=label)
  
      # Chain the detector gradients for the first component
      classifier_preds = self.classifier.predict(x=x)
      maxind_classifier_preds = np.argmax(classifier_preds, axis=1)
      max_classifier_preds = classifier_preds[
          np.arange(classifier_preds.shape[0]), maxind_classifier_preds
      ]
      first_detector_grads = (
          max_classifier_preds[:, None, None, None, None]
          * detector_grads
      )
  
      # Chain the detector gradients for the second component
      max_classifier_grads = classifier_grads[
          np.arange(len(classifier_grads)), maxind_classifier_preds
      ]
      detector_preds = self.detector.predict(x=x)
      second_detector_grads = (
          max_classifier_grads * (detector_preds + 1)[:, None, None]
      )
      second_detector_grads = second_detector_grads[None, ...]
      second_detector_grads = np.swapaxes(second_detector_grads, 0, 1)
  
      # Update detector gradients
      detector_grads = first_detector_grads + second_detector_grads
  
      # Combine the gradients
      combined_logits_grads = np.concatenate(
          [classifier_grads, detector_grads], axis=1
      )
  
      return combined_logits_grads
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import List, Optional, Union, Tuple, TYPE_CHECKING
  import numpy
  from art.estimators.classification.classifier import ClassifierNeuralNetwork
label_desc: Use image node_id 14 for calling the DetectorClassifier obj's underlying member method code with example usage: obj._compute_combined_grads(x, label) and returns: combined_logits_grads