Skip to content

Update Intro YouTube TensorBoard tutorial — v2 transforms, eval/train, stale comments #3857

@svekars

Description

@svekars

Description

The PyTorch TensorBoard Support tutorial uses deprecated torchvision transforms, non-idiomatic train/eval toggling, and contains stale workaround comments.

Note: Check the status of PR #3128 — the Oct 2024 Tutorial Audit decided to deprecate all TensorBoard tutorials. If that deprecation is proceeding, this issue may be superseded.

Changes needed

Deprecated APIs

  • transforms.ToTensor()v2.ToImage() + v2.ToDtype(torch.float32, scale=True): ToTensor() is deprecated since torchvision 0.18 and lives in torchvision.transforms._deprecated.py. Update Compose and Normalize to v2 namespace as well.

Outdated patterns

  • net.train(False) / net.train(True)net.eval() / net.train(): While functionally equivalent, model.eval() and model.train() are the idiomatic forms used in all current PyTorch tutorials.
  • Python 2-style super(Net, self).__init__()super().__init__()
  • .format() → f-strings: e.g., 'Batch {}'.format(i + 1)f'Batch {i + 1}'
  • Remove stale TensorFlow workaround comment (lines ~75-77): This was a workaround for an add_embedding bug in environments with TensorFlow installed. The bug was fixed long ago; the comment is confusing for readers.

Files

cc @subramen

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions