Validate perturbation baselines before attribution (#1920) - #1920
Open
craymichael wants to merge 1 commit into
Open
Validate perturbation baselines before attribution (#1920)#1920craymichael wants to merge 1 commit into
craymichael wants to merge 1 commit into
Conversation
Contributor
|
@craymichael has exported this pull request. If you are a Meta employee, you can view the originating Diff in D117601314. |
craymichael
added a commit
to craymichael/captum
that referenced
this pull request
Aug 28, 2026
Summary: Summary Feature Ablation and Shapley formatted baselines but did not validate tuple arity or tensor shape before running the model. `_tensorize_baseline` also paired inputs and baselines with `zip`, silently discarding extra baselines. Problem For two inputs, a one-element baseline tuple reached the model with a missing argument, while a three-element tuple silently ignored its final baseline. A baseline pool with shape `[2, 1]` for a three-row input was neither a per-example baseline nor a singleton baseline and failed later through opaque broadcasting errors. Fix * Validate baselines in both synchronous and future Feature Ablation and Shapley entry points. * Defensively reject arity mismatches in `_tensorize_baseline`. * Require Shapley tensor baselines to match the input or use a singleton leading dimension with matching trailing dimensions. * Preserve Feature Ablation’s documented support for any tensor shape that broadcasts exactly to the input, including `[F]` and 0-D tensors. Test Plan Before: the new regressions failed through late `IndexError`, missing-forward-argument, and broadcast errors; the extra-baseline case did not raise at all. After: * `buck test fbcode//pytorch/captum/tests/attr:test_common fbcode//pytorch/captum/tests/attr:test_feature_ablation fbcode//pytorch/captum/tests/attr:test_shapley` — Pass 131, Fail 0. * `arc lint -a` on changed Python files — no source lint issues; focused autodeps updates applied. * `arc lint -a --engine extra --take CITRINEAGENT` on changed Captum implementation files — no issues. * `arc pyre check-owning-targets` on changed files — no type errors. Differential Revision: D117601314
craymichael
force-pushed
the
export-D117601314
branch
from
August 28, 2026 17:19
8e21900 to
8f1eda0
Compare
craymichael
added a commit
to craymichael/captum
that referenced
this pull request
Aug 28, 2026
Summary: Summary Feature Ablation and Shapley formatted baselines but did not validate tuple arity or tensor shape before running the model. `_tensorize_baseline` also paired inputs and baselines with `zip`, silently discarding extra baselines. Problem For two inputs, a one-element baseline tuple reached the model with a missing argument, while a three-element tuple silently ignored its final baseline. A baseline pool with shape `[2, 1]` for a three-row input was neither a per-example baseline nor a singleton baseline and failed later through opaque broadcasting errors. Fix * Validate baselines in both synchronous and future Feature Ablation and Shapley entry points. * Defensively reject arity mismatches in `_tensorize_baseline`. * Require Shapley tensor baselines to match the input or use a singleton leading dimension with matching trailing dimensions. * Preserve Feature Ablation’s documented support for any tensor shape that broadcasts exactly to the input, including `[F]` and 0-D tensors. Test Plan Before: the new regressions failed through late `IndexError`, missing-forward-argument, and broadcast errors; the extra-baseline case did not raise at all. After: * `buck test fbcode//pytorch/captum/tests/attr:test_common fbcode//pytorch/captum/tests/attr:test_feature_ablation fbcode//pytorch/captum/tests/attr:test_shapley` — Pass 131, Fail 0. * `arc lint -a` on changed Python files — no source lint issues; focused autodeps updates applied. * `arc lint -a --engine extra --take CITRINEAGENT` on changed Captum implementation files — no issues. * `arc pyre check-owning-targets` on changed files — no type errors. Differential Revision: D117601314
craymichael
added a commit
to craymichael/captum
that referenced
this pull request
Aug 28, 2026
Summary: Summary Feature Ablation and Shapley formatted baselines but did not validate tuple arity or tensor shape before running the model. `_tensorize_baseline` also paired inputs and baselines with `zip`, silently discarding extra baselines. Problem For two inputs, a one-element baseline tuple reached the model with a missing argument, while a three-element tuple silently ignored its final baseline. A baseline pool with shape `[2, 1]` for a three-row input was neither a per-example baseline nor a singleton baseline and failed later through opaque broadcasting errors. Fix * Validate baselines in both synchronous and future Feature Ablation and Shapley entry points. * Defensively reject arity mismatches in `_tensorize_baseline`. * Require Shapley tensor baselines to match the input or use a singleton leading dimension with matching trailing dimensions. * Preserve Feature Ablation’s documented support for any tensor shape that broadcasts exactly to the input, including `[F]` and 0-D tensors. Test Plan Before: the new regressions failed through late `IndexError`, missing-forward-argument, and broadcast errors; the extra-baseline case did not raise at all. After: * `buck test fbcode//pytorch/captum/tests/attr:test_common fbcode//pytorch/captum/tests/attr:test_feature_ablation fbcode//pytorch/captum/tests/attr:test_shapley` — Pass 131, Fail 0. * `arc lint -a` on changed Python files — no source lint issues; focused autodeps updates applied. * `arc lint -a --engine extra --take CITRINEAGENT` on changed Captum implementation files — no issues. * `arc pyre check-owning-targets` on changed files — no type errors. Differential Revision: D117601314
craymichael
added a commit
to craymichael/captum
that referenced
this pull request
Aug 28, 2026
Summary: Summary Feature Ablation and Shapley formatted baselines but did not validate tuple arity or tensor shape before running the model. `_tensorize_baseline` also paired inputs and baselines with `zip`, silently discarding extra baselines. Problem For two inputs, a one-element baseline tuple reached the model with a missing argument, while a three-element tuple silently ignored its final baseline. A baseline pool with shape `[2, 1]` for a three-row input was neither a per-example baseline nor a singleton baseline and failed later through opaque broadcasting errors. Fix * Validate baselines in both synchronous and future Feature Ablation and Shapley entry points. * Defensively reject arity mismatches in `_tensorize_baseline`. * Require Shapley tensor baselines to match the input or use a singleton leading dimension with matching trailing dimensions. * Preserve Feature Ablation’s documented support for any tensor shape that broadcasts exactly to the input, including `[F]` and 0-D tensors. Test Plan Before: the new regressions failed through late `IndexError`, missing-forward-argument, and broadcast errors; the extra-baseline case did not raise at all. After: * `buck test fbcode//pytorch/captum/tests/attr:test_common fbcode//pytorch/captum/tests/attr:test_feature_ablation fbcode//pytorch/captum/tests/attr:test_shapley` — Pass 131, Fail 0. * `arc lint -a` on changed Python files — no source lint issues; focused autodeps updates applied. * `arc lint -a --engine extra --take CITRINEAGENT` on changed Captum implementation files — no issues. * `arc pyre check-owning-targets` on changed files — no type errors. Differential Revision: D117601314
Summary: Summary Feature Ablation and Shapley formatted baselines but did not validate tuple arity or tensor shape before running the model. `_tensorize_baseline` also paired inputs and baselines with `zip`, silently discarding extra baselines. Problem For two inputs, a one-element baseline tuple reached the model with a missing argument, while a three-element tuple silently ignored its final baseline. A baseline pool with shape `[2, 1]` for a three-row input was neither a per-example baseline nor a singleton baseline and failed later through opaque broadcasting errors. Fix * Validate baselines in both synchronous and future Feature Ablation and Shapley entry points. * Defensively reject arity mismatches in `_tensorize_baseline`. * Require Shapley tensor baselines to match the input or use a singleton leading dimension with matching trailing dimensions. * Preserve Feature Ablation’s documented support for any tensor shape that broadcasts exactly to the input, including `[F]` and 0-D tensors. Test Plan Before: the new regressions failed through late `IndexError`, missing-forward-argument, and broadcast errors; the extra-baseline case did not raise at all. After: * `buck test fbcode//pytorch/captum/tests/attr:test_common fbcode//pytorch/captum/tests/attr:test_feature_ablation fbcode//pytorch/captum/tests/attr:test_shapley` — Pass 131, Fail 0. * `arc lint -a` on changed Python files — no source lint issues; focused autodeps updates applied. * `arc lint -a --engine extra --take CITRINEAGENT` on changed Captum implementation files — no issues. * `arc pyre check-owning-targets` on changed files — no type errors. Differential Revision: D117601314
craymichael
added a commit
to craymichael/captum
that referenced
this pull request
Aug 28, 2026
Summary: Summary Feature Ablation and Shapley formatted baselines but did not validate tuple arity or tensor shape before running the model. `_tensorize_baseline` also paired inputs and baselines with `zip`, silently discarding extra baselines. Problem For two inputs, a one-element baseline tuple reached the model with a missing argument, while a three-element tuple silently ignored its final baseline. A baseline pool with shape `[2, 1]` for a three-row input was neither a per-example baseline nor a singleton baseline and failed later through opaque broadcasting errors. Fix * Validate baselines in both synchronous and future Feature Ablation and Shapley entry points. * Defensively reject arity mismatches in `_tensorize_baseline`. * Require Shapley tensor baselines to match the input or use a singleton leading dimension with matching trailing dimensions. * Preserve Feature Ablation’s documented support for any tensor shape that broadcasts exactly to the input, including `[F]` and 0-D tensors. Test Plan Before: the new regressions failed through late `IndexError`, missing-forward-argument, and broadcast errors; the extra-baseline case did not raise at all. After: * `buck test fbcode//pytorch/captum/tests/attr:test_common fbcode//pytorch/captum/tests/attr:test_feature_ablation fbcode//pytorch/captum/tests/attr:test_shapley` — Pass 131, Fail 0. * `arc lint -a` on changed Python files — no source lint issues; focused autodeps updates applied. * `arc lint -a --engine extra --take CITRINEAGENT` on changed Captum implementation files — no issues. * `arc pyre check-owning-targets` on changed files — no type errors. Differential Revision: D117601314
craymichael
force-pushed
the
export-D117601314
branch
from
August 28, 2026 17:48
8f1eda0 to
60b7366
Compare
craymichael
added a commit
to craymichael/captum
that referenced
this pull request
Aug 28, 2026
Summary: Summary Feature Ablation and Shapley formatted baselines but did not validate tuple arity or tensor shape before running the model. `_tensorize_baseline` also paired inputs and baselines with `zip`, silently discarding extra baselines. Problem For two inputs, a one-element baseline tuple reached the model with a missing argument, while a three-element tuple silently ignored its final baseline. A baseline pool with shape `[2, 1]` for a three-row input was neither a per-example baseline nor a singleton baseline and failed later through opaque broadcasting errors. Fix * Validate baselines in both synchronous and future Feature Ablation and Shapley entry points. * Defensively reject arity mismatches in `_tensorize_baseline`. * Require Shapley tensor baselines to match the input or use a singleton leading dimension with matching trailing dimensions. * Preserve Feature Ablation’s documented support for any tensor shape that broadcasts exactly to the input, including `[F]` and 0-D tensors. Test Plan Before: the new regressions failed through late `IndexError`, missing-forward-argument, and broadcast errors; the extra-baseline case did not raise at all. After: * `buck test fbcode//pytorch/captum/tests/attr:test_common fbcode//pytorch/captum/tests/attr:test_feature_ablation fbcode//pytorch/captum/tests/attr:test_shapley` — Pass 131, Fail 0. * `arc lint -a` on changed Python files — no source lint issues; focused autodeps updates applied. * `arc lint -a --engine extra --take CITRINEAGENT` on changed Captum implementation files — no issues. * `arc pyre check-owning-targets` on changed files — no type errors. Differential Revision: D117601314
craymichael
added a commit
to craymichael/captum
that referenced
this pull request
Aug 28, 2026
Summary: Summary Feature Ablation and Shapley formatted baselines but did not validate tuple arity or tensor shape before running the model. `_tensorize_baseline` also paired inputs and baselines with `zip`, silently discarding extra baselines. Problem For two inputs, a one-element baseline tuple reached the model with a missing argument, while a three-element tuple silently ignored its final baseline. A baseline pool with shape `[2, 1]` for a three-row input was neither a per-example baseline nor a singleton baseline and failed later through opaque broadcasting errors. Fix * Validate baselines in both synchronous and future Feature Ablation and Shapley entry points. * Defensively reject arity mismatches in `_tensorize_baseline`. * Require Shapley tensor baselines to match the input or use a singleton leading dimension with matching trailing dimensions. * Preserve Feature Ablation’s documented support for any tensor shape that broadcasts exactly to the input, including `[F]` and 0-D tensors. Test Plan Before: the new regressions failed through late `IndexError`, missing-forward-argument, and broadcast errors; the extra-baseline case did not raise at all. After: * `buck test fbcode//pytorch/captum/tests/attr:test_common fbcode//pytorch/captum/tests/attr:test_feature_ablation fbcode//pytorch/captum/tests/attr:test_shapley` — Pass 131, Fail 0. * `arc lint -a` on changed Python files — no source lint issues; focused autodeps updates applied. * `arc lint -a --engine extra --take CITRINEAGENT` on changed Captum implementation files — no issues. * `arc pyre check-owning-targets` on changed files — no type errors. Differential Revision: D117601314
craymichael
added a commit
to craymichael/captum
that referenced
this pull request
Aug 28, 2026
Summary: Summary Feature Ablation and Shapley formatted baselines but did not validate tuple arity or tensor shape before running the model. `_tensorize_baseline` also paired inputs and baselines with `zip`, silently discarding extra baselines. Problem For two inputs, a one-element baseline tuple reached the model with a missing argument, while a three-element tuple silently ignored its final baseline. A baseline pool with shape `[2, 1]` for a three-row input was neither a per-example baseline nor a singleton baseline and failed later through opaque broadcasting errors. Fix * Validate baselines in both synchronous and future Feature Ablation and Shapley entry points. * Defensively reject arity mismatches in `_tensorize_baseline`. * Require Shapley tensor baselines to match the input or use a singleton leading dimension with matching trailing dimensions. * Preserve Feature Ablation’s documented support for any tensor shape that broadcasts exactly to the input, including `[F]` and 0-D tensors. Test Plan Before: the new regressions failed through late `IndexError`, missing-forward-argument, and broadcast errors; the extra-baseline case did not raise at all. After: * `buck test fbcode//pytorch/captum/tests/attr:test_common fbcode//pytorch/captum/tests/attr:test_feature_ablation fbcode//pytorch/captum/tests/attr:test_shapley` — Pass 131, Fail 0. * `arc lint -a` on changed Python files — no source lint issues; focused autodeps updates applied. * `arc lint -a --engine extra --take CITRINEAGENT` on changed Captum implementation files — no issues. * `arc pyre check-owning-targets` on changed files — no type errors. Differential Revision: D117601314
craymichael
added a commit
to craymichael/captum
that referenced
this pull request
Aug 28, 2026
Summary: Summary Feature Ablation and Shapley formatted baselines but did not validate tuple arity or tensor shape before running the model. `_tensorize_baseline` also paired inputs and baselines with `zip`, silently discarding extra baselines. Problem For two inputs, a one-element baseline tuple reached the model with a missing argument, while a three-element tuple silently ignored its final baseline. A baseline pool with shape `[2, 1]` for a three-row input was neither a per-example baseline nor a singleton baseline and failed later through opaque broadcasting errors. Fix * Validate baselines in both synchronous and future Feature Ablation and Shapley entry points. * Defensively reject arity mismatches in `_tensorize_baseline`. * Require Shapley tensor baselines to match the input or use a singleton leading dimension with matching trailing dimensions. * Preserve Feature Ablation’s documented support for any tensor shape that broadcasts exactly to the input, including `[F]` and 0-D tensors. Test Plan Before: the new regressions failed through late `IndexError`, missing-forward-argument, and broadcast errors; the extra-baseline case did not raise at all. After: * `buck test fbcode//pytorch/captum/tests/attr:test_common fbcode//pytorch/captum/tests/attr:test_feature_ablation fbcode//pytorch/captum/tests/attr:test_shapley` — Pass 131, Fail 0. * `arc lint -a` on changed Python files — no source lint issues; focused autodeps updates applied. * `arc lint -a --engine extra --take CITRINEAGENT` on changed Captum implementation files — no issues. * `arc pyre check-owning-targets` on changed files — no type errors. Differential Revision: D117601314
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Summary
Feature Ablation and Shapley formatted baselines but did not validate tuple arity or tensor shape before running the model.
_tensorize_baselinealso paired inputs and baselines withzip, silently discarding extra baselines.Problem
For two inputs, a one-element baseline tuple reached the model with a missing argument, while a three-element tuple silently ignored its final baseline. A baseline pool with shape
[2, 1]for a three-row input was neither a per-example baseline nor a singleton baseline and failed later through opaque broadcasting errors.Fix
_tensorize_baseline.[F]and 0-D tensors.Test Plan
Before: the new regressions failed through late
IndexError, missing-forward-argument, and broadcast errors; the extra-baseline case did not raise at all.After:
buck test fbcode//pytorch/captum/tests/attr:test_common fbcode//pytorch/captum/tests/attr:test_feature_ablation fbcode//pytorch/captum/tests/attr:test_shapley— Pass 131, Fail 0.arc lint -aon changed Python files — no source lint issues; focused autodeps updates applied.arc lint -a --engine extra --take CITRINEAGENTon changed Captum implementation files — no issues.arc pyre check-owning-targetson changed files — no type errors.Differential Revision: D117601314