Skip to content

Commit

Permalink
Fix neuron guided backprop pyre fixme issues (#1465)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #1465

Fixing unresolved pyre fixme issues in corresponding file

Reviewed By: craymichael

Differential Revision: D67705091

fbshipit-source-id: 66e4ff9f23a80f582f55cac57d095a0cc8943971
  • Loading branch information
Vivek Miglani authored and facebook-github-bot committed Dec 31, 2024
1 parent 57d1f93 commit ff4bb4d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions captum/attr/_core/neuron/neuron_guided_backprop_deconvnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
from typing import Callable, List, Optional, Tuple, Union

from captum._utils.gradient import construct_neuron_grad_fn
from captum._utils.typing import TensorOrTupleOfTensorsGeneric
from captum._utils.typing import SliceIntType, TensorOrTupleOfTensorsGeneric
from captum.attr._core.guided_backprop_deconvnet import Deconvolution, GuidedBackprop
from captum.attr._utils.attribution import GradientAttribution, NeuronAttribution
from captum.log import log_usage
from torch import Tensor
from torch.nn import Module


Expand Down Expand Up @@ -60,8 +61,11 @@ def __init__(
def attribute(
self,
inputs: TensorOrTupleOfTensorsGeneric,
# pyre-fixme[24]: Generic type `Callable` expects 2 type parameters.
neuron_selector: Union[int, Tuple[Union[int, slice], ...], Callable],
neuron_selector: Union[
int,
Tuple[Union[int, SliceIntType], ...],
Callable[[Union[Tensor, Tuple[Tensor, ...]]], Tensor],
],
additional_forward_args: Optional[object] = None,
attribute_to_neuron_input: bool = False,
) -> TensorOrTupleOfTensorsGeneric:
Expand Down Expand Up @@ -215,8 +219,11 @@ def __init__(
def attribute(
self,
inputs: TensorOrTupleOfTensorsGeneric,
# pyre-fixme[24]: Generic type `Callable` expects 2 type parameters.
neuron_selector: Union[int, Tuple[Union[int, slice], ...], Callable],
neuron_selector: Union[
int,
Tuple[Union[int, SliceIntType], ...],
Callable[[Union[Tensor, Tuple[Tensor, ...]]], Tensor],
],
additional_forward_args: Optional[object] = None,
attribute_to_neuron_input: bool = False,
) -> TensorOrTupleOfTensorsGeneric:
Expand Down

0 comments on commit ff4bb4d

Please sign in to comment.