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: Get neuron selection array for neuron_selection_mode "index".
docstr_tok: ["Get","neuron","selection","array","for","neuron_selection_mode","``","index","''","."]
code: def _get_neuron_selection_array(
      self, neuron_selection: OptionalList[int], batch_size: int
  ) -> np.ndarray:
      """Get neuron selection array for neuron_selection_mode "index"."""
      nsa = np.asarray(neuron_selection).flatten()
  
      # If `nsa` is singleton, repeat it so that it matches the batch size
      if nsa.size == 1:
          nsa = np.repeat(nsa, batch_size)
  
      # Multiples of batch size are allowed for use with AugmentReduceBase:
      if nsa.size % batch_size != 0:
          raise ValueError(
              f"""`neuron_selection` should be integer or array matching
                  batch size {batch_size}. Got: {neuron_selection}"""
          )
  
      # We prepend a counter for the position in the batch,
      # which will be used by the layer `NeuronSelection`.
      # Using `nsa.size` for compatibility with AugmentReduceBase.
      batch_position_index = np.arange(nsa.size)
      return np.hstack(
          (batch_position_index.reshape((-1, 1)), nsa.reshape((-1, 1)))
      )
  
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 9 for calling the AnalyzerNetworkBase obj's underlying member method code with example usage: obj._get_neuron_selection_array(neuron_selection, batch_size) and returns: np