class_docstr: Base ModelInterface for torch and tensorflow models.
class_docstr_tok: ["Base","ModelInterface","for","torch","and","tensorflow","models","."]
docstr: Compute the model's internal representation of input x.
  In practice, this means, executing a forward pass and then, capturing the output of layers (of interest).
  As the exact definition of "internal model representation" is left out in the original paper (see: https://arxiv.org/pdf/2203.06877.pdf),
  we make the implementation flexible.
  It is up to the user whether all layers are used, or specific ones should be selected.
  The user can therefore select a layer by providing 'layer_names' (exclusive) or 'layer_indices'.
  
  Parameters
  ----------
  x: np.ndarray
      4D tensor, a batch of input datapoints
  layer_names: List[str]
      List with names of layers, from which output should be captured.
  layer_indices: List[int]
      List with indices of layers, from which output should be captured.
      Intended to use in case, when layer names are not unique, or unknown.
  
  Returns
  -------
  L: np.ndarray
      2D tensor with shape (batch_size, None)
docstr_tok: ["Compute","the","model","'s","internal","representation","of","input","x",".","In","practice",",","this","means",",","executing","a","forward","pass","and","then",",","capturing","the","output","of","layers","(","of","interest",")",".","As","the","exact","definition","of","``","internal","model","representation","''","is","left","out","in","the","original","paper","(","see",":","https",":","\/\/arxiv.org\/pdf\/2203.06877.pdf",")",",","we","make","the","implementation","flexible",".","It","is","up","to","the","user","whether","all","layers","are","used",",","or","specific","ones","should","be","selected",".","The","user","can","therefore","select","a","layer","by","providing","'layer_names","'","(","exclusive",")","or","'layer_indices","'",".","Parameters","--","--","--","--","--","x",":","np.ndarray","4D","tensor",",","a","batch","of","input","datapoints","layer_names",":","List","[","str","]","List","with","names","of","layers",",","from","which","output","should","be","captured",".","layer_indices",":","List","[","int","]","List","with","indices","of","layers",",","from","which","output","should","be","captured",".","Intended","to","use","in","case",",","when","layer","names","are","not","unique",",","or","unknown",".","Returns","--","--","--","-","L",":","np.ndarray","2D","tensor","with","shape","(","batch_size",",","None",")"]
code: def get_hidden_representations(
      self,
      x: np.ndarray,
      layer_names: Optional[List[str]] = None,
      layer_indices: Optional[List[int]] = None,
  ) -> np.ndarray:
      """
      Compute the model's internal representation of input x.
      In practice, this means, executing a forward pass and then, capturing the output of layers (of interest).
      As the exact definition of "internal model representation" is left out in the original paper (see: https://arxiv.org/pdf/2203.06877.pdf),
      we make the implementation flexible.
      It is up to the user whether all layers are used, or specific ones should be selected.
      The user can therefore select a layer by providing 'layer_names' (exclusive) or 'layer_indices'.
  
      Parameters
      ----------
      x: np.ndarray
          4D tensor, a batch of input datapoints
      layer_names: List[str]
          List with names of layers, from which output should be captured.
      layer_indices: List[int]
          List with indices of layers, from which output should be captured.
          Intended to use in case, when layer names are not unique, or unknown.
  
      Returns
      -------
      L: np.ndarray
          2D tensor with shape (batch_size, None)
      """
      raise NotImplementedError()
  
file_path: Quantus/quantus/helpers/model/model_interface.py
imports: import warnings
  from importlib import util
  from abc import ABC, abstractmethod
  from typing import Any, Dict, Optional, Tuple, List, Union, Generator, TypeVar, Generic
  import numpy
label_desc: Use image node_id 9 for calling the ModelInterface obj's underlying member method code with example usage: obj.get_hidden_representations(x, layer_names, layer_indices) without return types