Description
The Introduction to PyTorch Tensors and The Fundamentals of Autograd tutorials contain deprecated APIs and outdated patterns that should be modernized.
Changes needed
Deprecated APIs (both files)
torch.sin_(b) → b.sin_(): Module-level in-place functions (torch.sin_, torch.cos_, etc.) were deprecated in PyTorch 2.1. Use the tensor method .sin_() instead.
Outdated patterns (both files)
torch.linalg.matmul() → torch.matmul(): torch.linalg.matmul is a documented alias, but torch.matmul is the canonical name used in all PyTorch docs. Using the alias may confuse readers looking up the API.
.format() → f-strings: Replace old-style string formatting with f-strings (PEP 498).
- Update in-place ops documentation text: The tutorial text says in-place arithmetic is on
torch.Tensor, "not attached to the torch module like many other functions (e.g., torch.sin())". This contrast no longer applies after fixing torch.sin_(b) → b.sin_(). Update the surrounding explanation.
Files
cc @subramen
Description
The Introduction to PyTorch Tensors and The Fundamentals of Autograd tutorials contain deprecated APIs and outdated patterns that should be modernized.
Changes needed
Deprecated APIs (both files)
torch.sin_(b)→b.sin_(): Module-level in-place functions (torch.sin_,torch.cos_, etc.) were deprecated in PyTorch 2.1. Use the tensor method.sin_()instead.Outdated patterns (both files)
torch.linalg.matmul()→torch.matmul():torch.linalg.matmulis a documented alias, buttorch.matmulis the canonical name used in all PyTorch docs. Using the alias may confuse readers looking up the API..format()→ f-strings: Replace old-style string formatting with f-strings (PEP 498).torch.Tensor, "not attached to thetorchmodule like many other functions (e.g.,torch.sin())". This contrast no longer applies after fixingtorch.sin_(b)→b.sin_(). Update the surrounding explanation.Files
beginner_source/introyt/tensors_deeper_tutorial.pybeginner_source/introyt/autogradyt_tutorial.pycc @subramen