class_docstr: A perturbation based approach to compute attribution, involving
  replacing each contiguous rectangular region with a given baseline /
  reference, and computing the difference in output. For features located
  in multiple regions (hyperrectangles), the corresponding output differences
  are averaged to compute the attribution for that feature.
  
  The first patch is applied with the corner aligned with all indices 0,
  and strides are applied until the entire dimension range is covered. Note
  that this may cause the final patch applied in a direction to be cut-off
  and thus smaller than the target occlusion shape.
  
  More details regarding the occlusion (or grey-box / sliding window)
  method can be found in the original paper and in the DeepExplain
  implementation.
  https://arxiv.org/abs/1311.2901
  https://github.com/marcoancona/DeepExplain/blob/master/deepexplain\
  /tensorflow/methods.py#L401
class_docstr_tok: ["A","perturbation","based","approach","to","compute","attribution",",","involving","replacing","each","contiguous","rectangular","region","with","a","given","baseline","\/","reference",",","and","computing","the","difference","in","output",".","For","features","located","in","multiple","regions","(","hyperrectangles",")",",","the","corresponding","output","differences","are","averaged","to","compute","the","attribution","for","that","feature",".","The","first","patch","is","applied","with","the","corner","aligned","with","all","indices","0",",","and","strides","are","applied","until","the","entire","dimension","range","is","covered",".","Note","that","this","may","cause","the","final","patch","applied","in","a","direction","to","be","cut-off","and","thus","smaller","than","the","target","occlusion","shape",".","More","details","regarding","the","occlusion","(","or","grey-box","\/","sliding","window",")","method","can","be","found","in","the","original","paper","and","in","the","DeepExplain","implementation",".","https",":","\/\/arxiv.org\/abs\/1311.2901","https",":","\/\/github.com\/marcoancona\/DeepExplain\/blob\/master\/deepexplain\\","\/tensorflow\/methods.py","#","L401"]
docstr: Args:
  
      forward_func (Callable): The forward function of the model or
                  any modification of it.
docstr_tok: ["Args",":","forward_func","(","Callable",")",":","The","forward","function","of","the","model","or","any","modification","of","it","."]
code: def __init__(self, forward_func: Callable) -> None:
      r"""
      Args:
  
          forward_func (Callable): The forward function of the model or
                      any modification of it.
      """
      FeatureAblation.__init__(self, forward_func)
      self.use_weights = True
  
file_path: captum/captum/attr/_core/occlusion.py
imports: from typing import Any, Callable, Tuple, Union
  import numpy
  import torch
  from captum._utils.common import _format_tensor_into_tuples
  from captum._utils.typing import BaselineType, TargetType, TensorOrTupleOfTensorsGeneric
  from captum.attr._core.feature_ablation import FeatureAblation
  from captum.attr._utils.common import _format_and_verify_sliding_window_shapes, _format_and_verify_strides
  from captum.log import log_usage
  from torch import Tensor
label_desc: Use image node_id 1 to create a new Occlusion object from inherited base classes: FeatureAblation with example: obj = Occlusion(forward_func)