Skip to content

Update Intro YouTube Tensors & Autograd tutorials — deprecated in-place ops, matmul alias, formatting #3855

@svekars

Description

@svekars

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions