class_docstr: Convenience interface for analyzers.
  
  This class provides helpful functionality to create analyzer's.
  Basically it:
  
  * takes the input model and adds a layer that selects
    the desired output neuron to analyze.
  * passes the new model to :func:`_create_analysis` which should
    return the analysis as Keras tensors.
  * compiles the function and serves the output to :func:`analyze` calls.
  * allows :func:`_create_analysis` to return tensors
    that are intercept for debugging purposes.
  
  :param allow_lambda_layers: Allow the model to contain lambda layers.
docstr: Same interface as :class:`Analyzer` besides
  
  :param neuron_selection: If neuron_selection_mode is 'index' this
  should be an integer with the index for the chosen neuron.
  When analyzing batches, this should be a List of integer indices.
docstr_tok: ["Same","interface","as",":","class",":","`","Analyzer","`","besides",":","param","neuron_selection",":","If","neuron_selection_mode","is","'index","'","this","should","be","an","integer","with","the","index","for","the","chosen","neuron",".","When","analyzing","batches",",","this","should","be","a","List","of","integer","indices","."]
code: def analyze(
      self,
      X: OptionalList[np.ndarray],
      neuron_selection: OptionalList[int] | None = None,
  ) -> OptionalList[np.ndarray]:
      """
      Same interface as :class:`Analyzer` besides
  
      :param neuron_selection: If neuron_selection_mode is 'index' this
      should be an integer with the index for the chosen neuron.
      When analyzing batches, this should be a List of integer indices.
      """
      # TODO: what does should mean in docstring?
  
      if self._analyzer_model_done is False:
          self.create_analyzer_model()
  
      if (
          neuron_selection is not None
          and self._neuron_selection_mode != "index"
      ):
          raise ValueError(
              f"neuron_selection_mode {self._neuron_selection_mode} doesn't support ",
              "'neuron_selection' parameter.",
          )
  
      if (
          neuron_selection is None
          and self._neuron_selection_mode == "index"
      ):
          raise ValueError(
              "neuron_selection_mode 'index' expects 'neuron_selection' parameter."
          )
  
      ret: OptionalList[np.ndarray]
      if self._neuron_selection_mode == "index":
          if neuron_selection is not None:
              batch_size = np.shape(X)[0]
              indices = self._get_neuron_selection_array(
                  neuron_selection, batch_size
              )
              ret = self._analyzer_model.predict_on_batch([X, indices])
          else:
              raise RuntimeError(
                  'neuron_selection_mode "index" requires neuron_selection.'
              )
      else:
          ret = self._analyzer_model.predict_on_batch(X)
  
      if self._n_debug_output > 0:
          self._handle_debug_output(ret[-self._n_debug_output :])
          ret = ret[: -self._n_debug_output]
  
      return ibackend.unpack_singleton(ret)
  
imports: from __future__ import annotations
  from typing import Any
  import numpy
  import tensorflow.keras.backend
  import tensorflow.keras.layers
  import tensorflow.keras.models
  import innvestigate.backend
  import innvestigate.backend.checks
  import innvestigate.layers
  from innvestigate.analyzer.base import AnalyzerBase
  from innvestigate.backend.types import Layer, LayerCheck, Model, OptionalList, Tensor
label_desc: Use image node_id 8 for calling the AnalyzerNetworkBase obj's underlying member method code with example usage: obj.analyze(X, neuron_selection) and returns: ibackend