class_docstr: Binary detector of adversarial samples coming from evasion attacks. The detector uses an architecture provided by
  the user and is trained on the values of the activations of a classifier at a given layer.
class_docstr_tok: ["Binary","detector","of","adversarial","samples","coming","from","evasion","attacks",".","The","detector","uses","an","architecture","provided","by","the","user","and","is","trained","on","the","values","of","the","activations","of","a","classifier","at","a","given","layer","."]
code: def _get_activations(
      self,
      x: np.ndarray,
      layer: Union[int, str],
      batch_size: int,
      framework: bool = False,
  ) -> np.ndarray:
      x_activations = self.classifier.get_activations(
          x, layer, batch_size, framework
      )
      if x_activations is None:
          raise ValueError("Classifier activations are null.")
  
      if isinstance(x_activations, np.ndarray):
          return x_activations
  
      return x_activations.numpy()
  
file_path: adversarial-robustness-toolbox/art/defences/detector/evasion/binary_activation_detector.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import Tuple, Union, TYPE_CHECKING
  import numpy
  from art.defences.detector.evasion.evasion_detector import EvasionDetector
label_desc: Use image node_id 2 for calling the BinaryActivationDetector obj's underlying member method code with example usage: obj._get_activations(x, layer, batch_size, framework) and returns: x_activations, x_activations