Skip to content

Fix pyre type errors in Captum attr visualization helpers (#1874)#1874

Closed
Ayush-Warikoo wants to merge 1 commit into
meta-pytorch:masterfrom
Ayush-Warikoo:export-D110250340
Closed

Fix pyre type errors in Captum attr visualization helpers (#1874)#1874
Ayush-Warikoo wants to merge 1 commit into
meta-pytorch:masterfrom
Ayush-Warikoo:export-D110250340

Conversation

@Ayush-Warikoo

@Ayush-Warikoo Ayush-Warikoo commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary:

Captum's GitHub Actions Type checks / tests job (pyre) fails on two pre-existing type errors that are unrelated to any particular PR but block every PR's CI. This fixes both.

captum/attr/_core/llm_attr.py:251 — pyre Unsupported operand [58]: im.norm(val) (a matplotlib Normalize call) returns a numpy value, so the chained comparison 0.2 < im.norm(val) < 0.8 is not statically supported. Wrap the single scalar in float() before comparing. Behavior is unchanged.

captum/attr/_utils/visualization.py:1097 — pyre Incompatible parameter type [6]: plt.xlim expects Tuple[float, float], but was passed a list of numpy scalars. Pass a (float(...), float(...)) tuple instead. matplotlib accepts this identically.

Differential Revision: D110250340

@meta-cla meta-cla Bot added the cla signed label Jul 1, 2026
@meta-codesync

meta-codesync Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@Ayush-Warikoo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D110250340.

…ch#1874)

Summary:

Captum's GitHub Actions `Type checks / tests` job (pyre) fails on two pre-existing type errors that are unrelated to any particular PR but block every PR's CI. This fixes both.

`captum/attr/_core/llm_attr.py:251` — pyre `Unsupported operand [58]`: `im.norm(val)` (a matplotlib `Normalize` call) returns a numpy value, so the chained comparison `0.2 < im.norm(val) < 0.8` is not statically supported. Wrap the single scalar in `float()` before comparing. Behavior is unchanged.

`captum/attr/_utils/visualization.py:1097` — pyre `Incompatible parameter type [6]`: `plt.xlim` expects `Tuple[float, float]`, but was passed a list of numpy scalars. Pass a `(float(...), float(...))` tuple instead. matplotlib accepts this identically.

Differential Revision: D110250340




Signed-off-by: Ayush Warikoo <ayushw@meta.com>
@meta-codesync meta-codesync Bot changed the title Fix pyre type errors in Captum attr visualization helpers Fix pyre type errors in Captum attr visualization helpers (#1874) Jul 1, 2026
Ayush-Warikoo added a commit to Ayush-Warikoo/captum that referenced this pull request Jul 1, 2026
…ch#1874)

Summary:

Captum's GitHub Actions `Type checks / tests` job (pyre) fails on two pre-existing type errors that are unrelated to any particular PR but block every PR's CI. This fixes both.

`captum/attr/_core/llm_attr.py:251` — pyre `Unsupported operand [58]`: `im.norm(val)` (a matplotlib `Normalize` call) returns a numpy value, so the chained comparison `0.2 < im.norm(val) < 0.8` is not statically supported. Wrap the single scalar in `float()` before comparing. Behavior is unchanged.

`captum/attr/_utils/visualization.py:1097` — pyre `Incompatible parameter type [6]`: `plt.xlim` expects `Tuple[float, float]`, but was passed a list of numpy scalars. Pass a `(float(...), float(...))` tuple instead. matplotlib accepts this identically.

Differential Revision: D110250340
@meta-codesync meta-codesync Bot closed this in 0f05862 Jul 7, 2026
@meta-codesync

meta-codesync Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

This pull request has been merged in 0f05862.

@meta-codesync meta-codesync Bot added the Merged label Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant