Skip to content

Fix the dataset test failures#9327

Merged
NicolasHug merged 1 commit intopytorch:mainfrom
zy1git:dataset-test-failures
Jan 6, 2026
Merged

Fix the dataset test failures#9327
NicolasHug merged 1 commit intopytorch:mainfrom
zy1git:dataset-test-failures

Conversation

@zy1git
Copy link
Copy Markdown
Contributor

@zy1git zy1git commented Jan 5, 2026

Summary:
Fixed the test failures in #9317:
2026-01-05T15:58:40.1734062Z FAILED test/test_datasets.py::SintelTestCase::test_feature_types - TypeError: only 0-dimensional arrays can be converted to Python scalars
2026-01-05T15:58:40.1735400Z FAILED test/test_datasets.py::SintelTestCase::test_flow - TypeError: only 0-dimensional arrays can be converted to Python scalars
2026-01-05T15:58:40.1736711Z FAILED test/test_datasets.py::SintelTestCase::test_num_examples - TypeError: only 0-dimensional arrays can be converted to Python scalars
2026-01-05T15:58:40.1738053Z FAILED test/test_datasets.py::SintelTestCase::test_transforms - TypeError: only 0-dimensional arrays can be converted to Python scalars
2026-01-05T15:58:40.1739427Z FAILED test/test_datasets.py::SintelTestCase::test_tv_decode_image_support - TypeError: only 0-dimensional arrays can be converted to Python scalars
2026-01-05T15:58:40.1740948Z FAILED test/test_datasets.py::FlyingChairsTestCase::test_feature_types - TypeError: only 0-dimensional arrays can be converted to Python scalars
2026-01-05T15:58:40.1742330Z FAILED test/test_datasets.py::FlyingChairsTestCase::test_flow - TypeError: only 0-dimensional arrays can be converted to Python scalars
2026-01-05T15:58:40.1743690Z FAILED test/test_datasets.py::FlyingChairsTestCase::test_num_examples - TypeError: only 0-dimensional arrays can be converted to Python scalars
2026-01-05T15:58:40.1745092Z FAILED test/test_datasets.py::FlyingChairsTestCase::test_transforms - TypeError: only 0-dimensional arrays can be converted to Python scalars

In the latest NumPy, int() no longer accepts 1-dimensional arrays. np.fromfile(f, "<i4", count=1) returns a 1-dimensional array with one element (shape (1,)), not a 0-dimensional scalar. In old Numpy, calling int() on a 1-element array worked implicitly, but in newer versions, this raises TypeError: only 0-dimensional arrays can be converted to Python scalars. Thus, using .item() to extract the scalar value from the array can fix the test failures.

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Jan 5, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/9327

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

As of commit cb8b7bb with merge base 269805e (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the cla signed label Jan 5, 2026
@zy1git zy1git changed the title Fix the datsset test failture Fix the dataset test failture Jan 5, 2026
@zy1git zy1git changed the title Fix the dataset test failture Fix the dataset test failures Jan 5, 2026
Copy link
Copy Markdown
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for the fix @zy1git !

@NicolasHug NicolasHug merged commit 1e53952 into pytorch:main Jan 6, 2026
64 checks passed
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 6, 2026

Hey @NicolasHug!

You merged this PR, but no labels were added.
The list of valid labels is available at https://github.com/pytorch/vision/blob/main/.github/process_commit.py

NicolasHug pushed a commit to NicolasHug/vision that referenced this pull request Jan 6, 2026
NicolasHug added a commit that referenced this pull request Jan 6, 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.

2 participants