Modernize transforms tutorial to torchvision v2 API#3861
Modernize transforms tutorial to torchvision v2 API#3861omkar-334 wants to merge 1 commit intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3861
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 90cde13 with merge base 5efb99a ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Claude finished @sekyondaMeta's task in 1m 2s —— View job Review of PR #3861
Overall: This is a clean, well-scoped modernization. The changes correctly migrate from the deprecated Looks Good
Minor Suggestions (non-blocking)
VerdictThe PR is correct, well-motivated, and addresses issue #3853. The suggestions above are minor polish — this is ready to merge as-is. |
Fixes #3853
Description
files changed -
beginner_source/basics/transforms_tutorial.pytorchvision.transforms.ToTensor(deprecated since torchvision 0.16) with the v2 pipelinev2.Compose([v2.ToImage(), v2.ToDtype(torch.float32, scale=True)]).transformsnamespace import tofrom torchvision.transforms import v2.torch.zeros(...).scatter_(...)one-hot pattern withtorch.nn.functional.one_hot(torch.tensor(y), num_classes=10).float(), wrapped inv2.Lambda.v2.ToImage()+v2.ToDtype()andF.one_hotinstead ofToTensorandscatter_.Checklist
cc @subramen