Repository: pytorch
Issue: JIT, nn.utils.weight_norm and {save,load}_state_dict produce wrong results
Labels: oncall: jit,triaged

## 🐛 Bug


## To Reproduce

Steps to reproduce the behavior:

1. Create a basic nn.Module containing nn.utils.weight_norm
2. Create two instances of it - model1 and model2.
3. Copy model1's state into model2 with {save,load}_state_dict
4. model3 = torch.jit.script(model2)
5. Geneate random input tensor and forward it through model1, model2 and model3

As per `torch.allclose`, model3's forward(..) results will be different from results produced by model1 and model2.

6. "5" can be fixed by running model2's forward(..) at least once with random input BEFORE making model3 (see code for "if fixup:...")

```python
import sys
import numpy as np

import torch
from torch import nn

torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False

class Model(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv = nn.utils.weight_norm(nn.Conv2d(10, 10, 3))

    def forward(self, input):
        return self.conv(input)

if __name__ == '__main__':
    print(f"torch version: {torch.__version__}")
    fixup = True if len(sys.argv) > 1 and sys.argv[1] == "1" else False
    print(f"fixup: {fixup}")

    model1 = Model()
    model2 = Model()
    model2.load_state_dict(model1.state_dict())
    if fixup:
        _ = model2(torch.randn(16, 10, 100, 100, requires_grad=False))

    model3 = torch.jit.script(model2)

    with torch.no_grad():
        np.random.seed(42)
        torch.manual_seed(42)

        input = torch.randn(16, 10, 100, 100, requires_grad=False)

        out1 = model1(input)
        out2 = model2(input)
        out3 = model3(input)

    print(f"allclose(out1, out2): {torch.allclose(out1, out2)}")
    print(f"allclose(out2, out3): {torch.allclose(out2, out3)}")
    print(f"allclose(out1, out3): {torch.allclose(out1, out3)}")
```
## Expected behavior

Expected model3 to produce forward(..) results same as model1 and model2's.

## Environment

```
PyTorch version: 1.4.0a0+19cd90d
Is debug build: Yes
CUDA used to build PyTorch: Could not collect

OS: Ubuntu 19.10
GCC version: (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008
CMake version: version 3.13.4

Python version: 3.8
Is CUDA available: No
CUDA runtime version: Could not collect
GPU models and configuration: GPU 0: GeForce RTX 2080 SUPER
Nvidia driver version: 440.36
cuDNN version: Could not collect

Versions of relevant libraries:
[pip3] numpy==1.16.2
[conda] blas                      1.0                         mkl  
[conda] mkl                       2019.4                      243  
[conda] mkl-service               2.3.0            py38he904b0f_0  
[conda] mkl_fft                   1.0.15           py38ha843d7b_0  
[conda] mkl_random                1.1.0            py38h962f231_0  
[conda] torch                     1.4.0a0+19cd90d           dev_0    <develop>
```

```
PyTorch version: 1.3.1
Is debug build: No
CUDA used to build PyTorch: 10.1.243

OS: Ubuntu 19.10
GCC version: (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008
CMake version: version 3.13.4

Python version: 3.7
Is CUDA available: Yes
CUDA runtime version: Could not collect
GPU models and configuration: GPU 0: GeForce RTX 2080 SUPER
Nvidia driver version: 440.36
cuDNN version: Could not collect

Versions of relevant libraries:
[pip3] numpy==1.16.2
[conda] blas                      1.0                         mkl  
[conda] mkl                       2019.4                      243  
[conda] mkl-service               2.3.0            py37he904b0f_0  
[conda] mkl_fft                   1.0.15           py37ha843d7b_0  
[conda] mkl_random                1.1.0            py37hd6b4f25_0  
[conda] pytorch                   1.3.1           py3.7_cuda10.1.243_cudnn7.6.3_0    pytorch
[conda] torchvision               0.4.2                py37_cu101    pytorch
[conda] torchviz                  0.0.1                    pypi_0    pypi
```

cc @suo