class_docstr: Base ModelInterface for torch and tensorflow models.
class_docstr_tok: ["Base","ModelInterface","for","torch","and","tensorflow","models","."]
docstr: Initialisation of ModelInterface class.
  
  Parameters
  ----------
  model: torch.nn.Module, tf.keras.Model
      A model this will be wrapped in the ModelInterface:
  channel_first: boolean, optional
       Indicates of the image dimensions are channel first, or channel last. Inferred from the input shape if None.
  softmax: boolean
      Indicates whether to use softmax probabilities or logits in model prediction.
      This is used for this __call__ only and won't be saved as attribute. If None, self.softmax is used.
  model_predict_kwargs: dict, optional
      Keyword arguments to be passed to the model's predict method.
docstr_tok: ["Initialisation","of","ModelInterface","class",".","Parameters","--","--","--","--","--","model",":","torch.nn.Module",",","tf.keras.Model","A","model","this","will","be","wrapped","in","the","ModelInterface",":","channel_first",":","boolean",",","optional","Indicates","of","the","image","dimensions","are","channel","first",",","or","channel","last",".","Inferred","from","the","input","shape","if","None",".","softmax",":","boolean","Indicates","whether","to","use","softmax","probabilities","or","logits","in","model","prediction",".","This","is","used","for","this","__call__","only","and","wo","n't","be","saved","as","attribute",".","If","None",",","self.softmax","is","used",".","model_predict_kwargs",":","dict",",","optional","Keyword","arguments","to","be","passed","to","the","model","'s","predict","method","."]
code: def __init__(
      self,
      model: M,
      channel_first: Optional[bool] = True,
      softmax: bool = False,
      model_predict_kwargs: Optional[Dict[str, Any]] = None,
  ):
      """
      Initialisation of ModelInterface class.
  
      Parameters
      ----------
      model: torch.nn.Module, tf.keras.Model
          A model this will be wrapped in the ModelInterface:
      channel_first: boolean, optional
           Indicates of the image dimensions are channel first, or channel last. Inferred from the input shape if None.
      softmax: boolean
          Indicates whether to use softmax probabilities or logits in model prediction.
          This is used for this __call__ only and won't be saved as attribute. If None, self.softmax is used.
      model_predict_kwargs: dict, optional
          Keyword arguments to be passed to the model's predict method.
      """
      self.model = model
      self.channel_first = channel_first
      self.softmax = softmax
  
      if model_predict_kwargs is None:
          self.model_predict_kwargs = {}
      else:
          self.model_predict_kwargs = model_predict_kwargs
  
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 1 to create a new ModelInterface object from inherited base classes: ABC, Generic with example: obj = ModelInterface(model, channel_first, softmax, model_predict_kwargs)