Commit 75297f4
fix(optimization_tutorial): replace deprecated ToTensor with v2 transforms (#3870)
Fixes #3854
## Description
- Replace deprecated `torchvision.transforms.ToTensor()` with
`v2.Compose([v2.ToImage(), v2.ToDtype(torch.float32, scale=True)])` in
`beginner_source/basics/optimization_tutorial.py`
- Aligns the tutorial with the supported torchvision v2 transforms API
(ToTensor deprecated since torchvision 0.16)
## Checklist
- [x] The issue that is being fixed is referred in the description (see
above "Fixes #ISSUE_NUMBER")
- [x] Only one issue is addressed in this pull request
- [x] Labels from the issue that this PR is fixing are added to this
pull request
- [x] No unnecessary issues are included into this pull request.
cc @subramen @svekars
Co-authored-by: sekyondaMeta <127536312+sekyondaMeta@users.noreply.github.com>1 parent 58d1185 commit 75297f4
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
0 commit comments