Repository navigation
Fix MeanAveragePrecision on non-contiguous inputs - #3901
Open
mottopanikeiku wants to merge 1 commit into
Open
mottopanikeiku wants to merge 1 commit into
mottopanikeiku wants to merge 1 commit into
Conversation
I replaced view with reshape when flattening binary inputs and multiclass targets. Valid transposed segmentation tensors previously raised instead of computing average precision. I added regression tests comparing strided inputs with their contiguous equivalents and documented that layout is supported. Assisted-by: Claude Assisted-by: GPT-6 Astra Signed-off-by: mottopanikeiku <176798723+mottopanikeiku@users.noreply.github.com>
This branch has not been deployed
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.
Description:
Use
reshapeinstead ofviewwhen flattening binary inputs and multiclass targets, matching the other paths in_prepare_output. This fixes evaluation on valid transposed segmentation tensors. Add four layout regression cases and document the supported layout.Reproducer:
RuntimeError: view size is not compatible with input tensor's size and stride1.0Tests:
pytest tests/ignite/metrics/test_mean_average_precision.py -m 'not distributed and not tpu': 15 passed, 36 deselected. Three new cases fail before the fix; the fourth is an existing-supported-layout control. Ruff check and format check pass.Check list:
I used AI assistance (Claude and GPT-6 Astra) to find, fix and test this bug.