Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions captum/attr/_core/feature_ablation.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def attribute(
feature_mask: Union[None, Tensor, Tuple[Tensor, ...]] = None,
perturbations_per_eval: int = 1,
show_progress: bool = False,
enable_cross_tensor_attribution: bool = False,
enable_cross_tensor_attribution: bool = True,
**kwargs: Any,
) -> TensorOrTupleOfTensorsGeneric:
r"""
Expand Down Expand Up @@ -744,7 +744,7 @@ def attribute_future(
feature_mask: Union[None, Tensor, Tuple[Tensor, ...]] = None,
perturbations_per_eval: int = 1,
show_progress: bool = False,
enable_cross_tensor_attribution: bool = False,
enable_cross_tensor_attribution: bool = True,
**kwargs: Any,
) -> Future[TensorOrTupleOfTensorsGeneric]:
r"""
Expand Down
4 changes: 2 additions & 2 deletions captum/attr/_core/feature_permutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def attribute( # type: ignore
feature_mask: Union[None, TensorOrTupleOfTensorsGeneric] = None,
perturbations_per_eval: int = 1,
show_progress: bool = False,
enable_cross_tensor_attribution: bool = False,
enable_cross_tensor_attribution: bool = True,
**kwargs: Any,
) -> TensorOrTupleOfTensorsGeneric:
r"""
Expand Down Expand Up @@ -304,7 +304,7 @@ def attribute_future(
feature_mask: Union[None, TensorOrTupleOfTensorsGeneric] = None,
perturbations_per_eval: int = 1,
show_progress: bool = False,
enable_cross_tensor_attribution: bool = False,
enable_cross_tensor_attribution: bool = True,
**kwargs: Any,
) -> Future[TensorOrTupleOfTensorsGeneric]:
"""
Expand Down
1 change: 0 additions & 1 deletion captum/attr/_core/occlusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ def attribute( # type: ignore
shift_counts=tuple(shift_counts),
strides=strides,
show_progress=show_progress,
enable_cross_tensor_attribution=True,
)

def attribute_future(self) -> None:
Expand Down
4 changes: 2 additions & 2 deletions tests/attr/test_feature_permutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ def forward_func(x: Tensor) -> Tensor:
inp = torch.tensor([[1.0, 2.0]])
assertTensorAlmostEqual(
self,
feature_importance.attribute(inp),
feature_importance.attribute(inp, enable_cross_tensor_attribution=False),
torch.tensor([[0.0, 0.0]]),
delta=0.0,
)

feature_importance._min_examples_per_batch = 1
with self.assertRaises(AssertionError):
feature_importance.attribute(inp)
feature_importance.attribute(inp, enable_cross_tensor_attribution=False)

def test_simple_input_with_min_examples_in_group(self) -> None:
def forward_func(x: Tensor) -> Tensor:
Expand Down
Loading