Skip to content

Update torch.var documentation to use modern API#167209

Closed
mohsinm-dev wants to merge 1 commit intopytorch:mainfrom
mohsinm-dev:fix-torch-var-doc-issue-166804
Closed

Update torch.var documentation to use modern API#167209
mohsinm-dev wants to merge 1 commit intopytorch:mainfrom
mohsinm-dev:fix-torch-var-doc-issue-166804

Conversation

@mohsinm-dev
Copy link
Copy Markdown
Contributor

Summary

Fix outdated unbiased parameter references in normalization module documentation. Replace deprecated torch.var(input, unbiased=False/True) with modern torch.var(input, correction=0/1) API throughout BatchNorm, InstanceNorm, LayerNorm, and GroupNorm docstrings.

Changes

  • torch/nn/modules/batchnorm.py: Updated 4 instances across BatchNorm1d, BatchNorm2d, BatchNorm3d, and SyncBatchNorm
  • torch/nn/modules/instancenorm.py: Updated 3 instances across InstanceNorm1d, InstanceNorm2d, and InstanceNorm3d
  • torch/nn/modules/normalization.py: Updated 2 instances in LayerNorm and GroupNorm

Test plan

Mathematical behavior remains identical: unbiased=False ≡ correction=0 (biased estimator), unbiased=True ≡ correction=1 (unbiased estimator). Documentation now uses consistent modern API terminology with no functional changes to code behavior.

Fixes #166804

Fix outdated `unbiased` parameter references in normalization module documentation.
Replace deprecated `torch.var(input, unbiased=False/True)` with modern
`torch.var(input, correction=0/1)` API throughout BatchNorm, InstanceNorm,
LayerNorm, and GroupNorm docstrings.

The mathematical behavior remains identical:
- unbiased=False ≡ correction=0 (biased estimator)
- unbiased=True ≡ correction=1 (unbiased estimator)

Fixes pytorch#166804
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Nov 6, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/167209

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit c74d230 with merge base a51208c (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Nov 6, 2025

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: mohsinm-dev / name: Mohsin Mehmood (c74d230)

@mohsinm-dev
Copy link
Copy Markdown
Contributor Author

@pytorchbot label "release notes: documentation"

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Nov 6, 2025

Didn't find following labels among repository labels: release notes: documentation

@mohsinm-dev
Copy link
Copy Markdown
Contributor Author

@pytorchbot label "release notes: nn"

@pytorch-bot pytorch-bot bot added the release notes: nn release notes category label Nov 6, 2025
Copy link
Copy Markdown
Collaborator

@albanD albanD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup. Thanks!

@albanD
Copy link
Copy Markdown
Collaborator

albanD commented Nov 6, 2025

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 6, 2025
@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

yarongmu-google pushed a commit to yarongmu-google/pytorch that referenced this pull request Nov 7, 2025
## Summary
Fix outdated unbiased parameter references in normalization module documentation. Replace deprecated torch.var(input, unbiased=False/True) with modern torch.var(input, correction=0/1) API throughout BatchNorm, InstanceNorm, LayerNorm, and GroupNorm docstrings.

## Changes
- torch/nn/modules/batchnorm.py: Updated 4 instances across BatchNorm1d, BatchNorm2d, BatchNorm3d, and SyncBatchNorm
- torch/nn/modules/instancenorm.py: Updated 3 instances across InstanceNorm1d, InstanceNorm2d, and InstanceNorm3d
- torch/nn/modules/normalization.py: Updated 2 instances in LayerNorm and GroupNorm

## Test plan
Mathematical behavior remains identical: unbiased=False ≡ correction=0 (biased estimator), unbiased=True ≡ correction=1 (unbiased estimator). Documentation now uses consistent modern API terminology with no functional changes to code behavior.

Fixes pytorch#166804
Pull Request resolved: pytorch#167209
Approved by: https://github.com/albanD
Silv3S pushed a commit to Silv3S/pytorch that referenced this pull request Nov 18, 2025
## Summary
Fix outdated unbiased parameter references in normalization module documentation. Replace deprecated torch.var(input, unbiased=False/True) with modern torch.var(input, correction=0/1) API throughout BatchNorm, InstanceNorm, LayerNorm, and GroupNorm docstrings.

## Changes
- torch/nn/modules/batchnorm.py: Updated 4 instances across BatchNorm1d, BatchNorm2d, BatchNorm3d, and SyncBatchNorm
- torch/nn/modules/instancenorm.py: Updated 3 instances across InstanceNorm1d, InstanceNorm2d, and InstanceNorm3d
- torch/nn/modules/normalization.py: Updated 2 instances in LayerNorm and GroupNorm

## Test plan
Mathematical behavior remains identical: unbiased=False ≡ correction=0 (biased estimator), unbiased=True ≡ correction=1 (unbiased estimator). Documentation now uses consistent modern API terminology with no functional changes to code behavior.

Fixes pytorch#166804
Pull Request resolved: pytorch#167209
Approved by: https://github.com/albanD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged open source release notes: nn release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reference to old argument name of torch.var in LayerNorm documentation page

4 participants