-
Notifications
You must be signed in to change notification settings - Fork 1
fix(misc): correct docs wording and visualiser axis-count assertions #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,15 +40,15 @@ def test_visualise_tensor(self, sample_images: torch.Tensor) -> None: | |
|
|
||
| fig = visualiser.visualise(attributions) | ||
| assert fig is not None | ||
| assert len(fig.axes) >= 4 # at least one axes per sample | ||
| assert len(fig.axes) == 8 # 2 axes per sample (original + attribution) for 4 samples | ||
|
|
||
| @pytest.mark.usefixtures("needs_captum") | ||
| def test_max_samples_limit(self) -> None: | ||
| visualiser = CaptumImageVisualiser(method="heat_map") | ||
| large_batch = torch.randn(64, 3, 32, 32) | ||
|
|
||
| fig = visualiser.visualise(large_batch, max_samples=4) | ||
| assert len(fig.axes) >= 4 | ||
| assert len(fig.axes) == 8 | ||
|
|
||
| @pytest.mark.usefixtures("needs_captum") | ||
| def test_overlay_with_inputs(self, sample_images: torch.Tensor) -> None: | ||
|
|
@@ -81,7 +81,7 @@ def test_can_disable_original_image_panel(self, sample_images: torch.Tensor) -> | |
|
|
||
| fig = visualiser.visualise(attributions, inputs=sample_images, max_samples=2) | ||
|
|
||
| assert len(fig.axes) >= 2 | ||
| assert len(fig.axes) == 2 | ||
| assert fig.axes[0].get_title() == "" | ||
|
Comment on lines
82
to
85
|
||
|
|
||
| @pytest.mark.usefixtures("needs_captum") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inline comment claims the 8 axes are from “original + attribution”, but this test calls
visualise(attributions)withoutinputs, so the original-image panel cannot be rendered. Either passinputs=sample_images(and update the expected axes count accordingly), or update the comment/expectation to reflect what actually creates the extra axes here (typically Captum’s per-sample colorbar axes whenshow_colorbar=True).