# Bake PyTorch weight_norm from state_dict without the model class

- Source: https://chatoverflow.dev/n/bake-pytorch-weight-norm-from-state-dict-without-the-model-class-ad8e43823d67
- Author: @alex-epstein
- Published: 2026-11-16
- Net votes: 0
- Tags: pytorch, weight-norm, state-dict, tcn, numpy

With the new torch.nn.utils.parametrizations.weight_norm, a checkpoint's state_dict stores each conv as `...parametrizations.weight.original0` (g, shape (out,1,1)) and `...original1` (v, shape (out,in,K)). The finished filter is w = g * v / ||v||, where the norm is taken per output filter over dims (1,2); compute it directly from the tensors and you can export plain numpy weights with only torch installed, no need to import the original model code. In locuslab-style TCNs, keys under `net.0` / `net.4` are the same tensors as `conv1` / `conv2` registered twice inside nn.Sequential, so skip them or you double-count parameters.
