Comments (1)
The trigger for this was a deprecation message warnings.warn("torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.")
.
If we look at weight_norm's documentation, it doesn't mention that we now have to use remove_parametrizations. I found out about that fact by trying to diff nn/utils/weight_norm.py nn/utils/parametrizations.py
and noticing that the documentation, in the code, for weight_norm()
says
* To remove the weight normalization reparametrization, use
:func:`torch.nn.utils.parametrize.remove_parametrizations`.
Starting from torch.nn, it appears that the link for weight_norm is broken as it doesn't bring weight_norm
's documentation but rather simply brings us to the end of the page. But if we search for weight_norm
and then click on torch.nn.utils.parametrizations.weight_norm, we get some documentation but no mention of having to use remove_paramatrizations()
like it is said in the code itself.
Using weight_norm()
with remove_parametrizations()
we get the expected behavior.
#!/usr/bin/env python3
# coding: utf-8
#
from torch.nn import ConvTranspose1d
from torch.nn.utils.parametrizations import weight_norm
from torch.nn.utils.parametrize import remove_parametrizations
c = ConvTranspose1d(512, 256, kernel_size=(16,), stride=(8,), padding=(4,))
print(c)
m = weight_norm(c)
print(m)
remove_parametrizations(m, "weight")
ConvTranspose1d(512, 256, kernel_size=(16,), stride=(8,), padding=(4,))
ParametrizedConvTranspose1d(
512, 256, kernel_size=(16,), stride=(8,), padding=(4,)
(parametrizations): ModuleDict(
(weight): ParametrizationList(
(0): _WeightNorm()
)
)
)
from pytorch.
Related Issues (20)
- Allow operators with no returns to be "out=" operations HOT 2
- Tensorboard's SummaryWriter.add_graph() doesn't work with packedSequence
- DISABLED test_binary_op_list_error_cases__foreach_clamp_max_cuda_float64 (__main__.TestForeachCUDA) HOT 1
- [Feature Request] Support `dtype` arg in `torch._foreach_norm` HOT 2
- Support auto_functionalized for None returns
- TOR901 lint is too aggressive HOT 1
- MPS backend thinks that small floats are less than zero
- DISABLED test_dynamic_shapes (__main__.TestCompiledAutograd) HOT 2
- DISABLED test_select_expanded_v (__main__.TestAutogradWithCompiledAutograd) HOT 2
- DISABLED test_foreach_matches_forloop_RAdam_cpu_float64 (__main__.TestOptimRenewedCPU) HOT 2
- DISABLED test_sdpa_backwards_cuda_bfloat16 (__main__.TestNestedTensorSubclassCUDA) HOT 1
- 404 on torch.inference_mode doc page
- 2.2.0+ regresses SDPA performance on Windows
- DISABLED test_setting_default_saved_variable_hooks_twice_should_use_inner (__main__.TestAutogradWithCompiledAutograd) HOT 2
- Inductor can not fuse cat with a pointwise HOT 1
- [Inductor] Generate triton block pointers for discontiguous strided tensors HOT 3
- `torch.compile` fails with `jacfwd` when multiplying/dividing float and tensor HOT 1
- [Distributed] P2P Operations on NCCL do not respect tag HOT 1
- Triton installation not found.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch.