[BUG] - Incorrect output on Parametrizations Tutorial when leave_parametrized=False
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9.3k
- Forks
- 4.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 4
Description
Add Link
https://pytorch.org/tutorials/intermediate/parametrizations.html
Describe the bug
The code sample has no bug but the example output is wrong. The "weight" from after remove_parametrizations(layer, "weight", leave_parametrized=False) should be same as that from "Before" but instead it is shown as that of"Parametrized". I was confused until I tried out the code. It does change it back to the weights from "Before".
Before:
Linear(in_features=3, out_features=3, bias=True)
Parameter containing:
tensor([[-0.3447, -0.3777, 0.5038],
[ 0.2042, 0.0153, 0.0781],
[-0.4640, -0.1928, 0.5558]], requires_grad=True)
Parametrized:
ParametrizedLinear(
in_features=3, out_features=3, bias=True
(parametrizations): ModuleDict(
(weight): ParametrizationList(
(0): Skew()
)
)
)
tensor([[ 0.0000, -0.3777, 0.5038],
[ 0.3777, 0.0000, 0.0781],
[-0.5038, -0.0781, 0.0000]], grad_fn=)
After. Same as Before:
Linear(in_features=3, out_features=3, bias=True)
Parameter containing:
tensor([[ 0.0000, -0.3777, 0.5038],
[ 0.0000, 0.0000, 0.0781],
[ 0.0000, 0.0000, 0.0000]], requires_grad=True)
Describe your environment
Does not matter because there is no bug. It is just the output from the tutorial page.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open the parametrizations tutorial at the linked URL and compare the displayed output after remove_parametrizations(layer, "weight", leave_parametrized=False) with the behavior of the sample code. Update the incorrect example output so it matches the restored weights, then verify the tutorial renders the corrected output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100