Skip to content
Closed
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
5 changes: 4 additions & 1 deletion captum/attr/_core/feature_ablation.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,10 @@ def _construct_ablated_input(
current_mask = current_mask.to(expanded_input.device)
assert baseline is not None, "baseline must be provided"
ablated_tensor = (
expanded_input * (1 - current_mask).to(expanded_input.dtype)
expanded_input
* (1 - current_mask).to(expanded_input.dtype)
# pyre-fixme[58]: `*` is not supported for operand types `Union[None, float,
# Tensor]` and `Tensor`.
) + (baseline * current_mask.to(expanded_input.dtype))
return ablated_tensor, current_mask

Expand Down
2 changes: 2 additions & 0 deletions captum/attr/_core/occlusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ def _construct_ablated_input(
torch.ones(1, dtype=torch.long, device=expanded_input.device)
- input_mask
).to(expanded_input.dtype)
# pyre-fixme[58]: `*` is not supported for operand types `Union[None, float,
# Tensor]` and `Tensor`.
) + (baseline * input_mask.to(expanded_input.dtype))
return ablated_tensor, input_mask

Expand Down
Loading