Skip to content

replace remaining read_image by decode_image#3516

Open
tttiago wants to merge 2 commits intopytorch:mainfrom
tttiago:tttiago-replace-read-image
Open

replace remaining read_image by decode_image#3516
tttiago wants to merge 2 commits intopytorch:mainfrom
tttiago:tttiago-replace-read-image

Conversation

@tttiago
Copy link

@tttiago tttiago commented Aug 7, 2025

Fixes #3501

Description

Replaced the read_image that was still remaining by decode_image.

Checklist

  • The issue that is being fixed is referred in the description (see above "Fixes #ISSUE_NUMBER")
  • Only one issue is addressed in this pull request
  • Labels from the issue that this PR is fixing are added to this pull request
  • No unnecessary issues are included into this pull request.

@pytorch-bot
Copy link

pytorch-bot bot commented Aug 7, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3516

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

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

@meta-cla
Copy link

meta-cla bot commented Aug 7, 2025

Hi @tttiago!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla
Copy link

meta-cla bot commented Aug 7, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla bot added the cla signed label Aug 7, 2025
@github-actions
Copy link

github-actions bot commented Oct 9, 2025

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as stale.
Feel free to remove the stale label if you feel this was a mistake.
If you are unable to remove the stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
stale pull requests will automatically be closed after 30 days of inactivity.

@github-actions github-actions bot added the stale Stale PRs label Oct 9, 2025
@github-actions github-actions bot closed this Nov 9, 2025
@sekyondaMeta sekyondaMeta reopened this Mar 20, 2026
@sekyondaMeta
Copy link
Contributor

@claude

@claude
Copy link

claude bot commented Mar 20, 2026

Claude finished @sekyondaMeta's task in 2m 17s —— View job


PR Review: #3516

  • Gather context and understand the PR changes
  • Review the changes for correctness
  • Check for remaining read_image usages across the repo
  • Post review feedback

Summary

This PR replaces a single remaining read_image call with decode_image in beginner_source/basics/data_tutorial.py, fixing issue #3501. The change in the PR's own commit (78b6b56) is correct and consistent — the file now uses decode_image everywhere, including the import statement, prose references, and all call sites.

Code Correctness

No concerns with the changed file. After the change, beginner_source/basics/data_tutorial.py consistently uses decode_image:

  • Import at line 123: from torchvision.io import decode_image
  • Usage at lines 137 and 193: image = decode_image(img_path)
  • Prose reference at line 187 also mentions decode_image

Incomplete Scope

The PR title says "replace remaining read_image by decode_image", and the issue #3501 likely tracks all remaining usages. However, intermediate_source/torchvision_tutorial.py still has 7 occurrences of read_image that are not addressed:

Line Usage
110 from torchvision.io import read_image
113 image = read_image("data/PennFudanPed/PNGImages/FudanPed00046.png")
114 mask = read_image("data/PennFudanPed/PedMasks/FudanPed00046_mask.png")
141 from torchvision.io import read_image
160 img = read_image(img_path)
161 mask = read_image(mask_path)
493 image = read_image("data/PennFudanPed/PNGImages/FudanPed00046.png")

These should likely be updated in this PR as well to fully resolve the issue.

Structure & Formatting

No concerns — this is a single-line code change with no structural impact.

Build Compatibility

No concerns — decode_image is the current recommended API in torchvision and is already used elsewhere in the codebase.

Recommendation

Request Changes

The change itself is correct, but the PR should also update intermediate_source/torchvision_tutorial.py to replace its 7 remaining read_image calls with decode_image. Without that, the goal of removing all read_image usage (as stated in the PR title and issue) is only partially achieved.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feedback about Datasets & DataLoaders

2 participants