Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - Incorrect output on Parametrizations Tutorial when leave_parametrized=False #3078

Open
lampuiho opened this issue Oct 6, 2024 · 2 comments
Labels

Comments

@lampuiho
Copy link

lampuiho commented Oct 6, 2024

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)

image

Describe your environment

Does not matter because there is no bug. It is just the output from the tutorial page.

@lampuiho lampuiho added the bug label Oct 6, 2024
@svekars
Copy link
Contributor

svekars commented Oct 7, 2024

@lezcano any thoughts?

@lezcano
Copy link
Contributor

lezcano commented Oct 8, 2024

what I don't quite understand is why do we get the wrong result. I thought the results were generated by running the scripts in the tutorial?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants