Repository: pytorch
Issue: ScriptModule and nn.Module parameter ordering difference
Labels: oncall: jit,triaged,jit-backlog

```python
class eagerNet(nn.Module):
    def __init__(self):
        super(eagerNet, self).__init__()
        self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
        self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
        self.fc1 = nn.Linear(320, 50)
        self.fc2 = nn.Linear(50, 10)

    def forward(self, x):
        x = F.relu(F.max_pool2d(self.conv1(x), 2))
        x = F.relu(F.max_pool2d(self.conv2(x), 2))
        x = x.view(-1, 320)
        x = F.relu(self.fc1(x))
        x = self.fc2(x)
        return F.log_softmax(x, dim=1)

class Net(torch.jit.ScriptModule):
    def __init__(self):
        super(Net, self).__init__()
        self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
        self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
        self.fc1 = nn.Linear(320, 50)
        self.fc2 = nn.Linear(50, 10)

    @torch.jit.script_method
    def forward(self, x):
        x = F.relu(F.max_pool2d(self.conv1(x), 2))
        x = F.relu(F.max_pool2d(self.conv2(x), 2))
        x = x.view(-1, 320)
        x = F.relu(self.fc1(x))
        x = self.fc2(x)
        return F.log_softmax(x, dim=1)

eager_model = eagerNet()
script_model = Net()
print("eager model param 0: ")
print(list(eager_model.named_parameters())[0])
print("script model param 0: ")
print(list(script_model.named_parameters())[0])
 ```
 
 =============================
 
 ```
 ('conv1.weight', Parameter containing:
tensor([[[[ 0.0946, -0.1856, -0.1759, -0.1680, -0.0602],
          [-0.1952, -0.1681,  0.1372,  0.0431, -0.1744],
          [ 0.1715, -0.0544,  0.0140, -0.1555, -0.0255],
          [ 0.1639, -0.0982, -0.1247,  0.1445, -0.1768],
          [-0.0441, -0.0565, -0.0862,  0.0288,  0.0915]]],


        [[[-0.0425, -0.0993, -0.1411,  0.1799, -0.1599],
          [-0.1578,  0.0246, -0.0017,  0.1814,  0.1217],
          [ 0.1685,  0.1819, -0.0780, -0.1456, -0.1026],
          [ 0.1407, -0.0840, -0.0971, -0.0261,  0.0718],
          [-0.0344,  0.1488,  0.1145,  0.0793, -0.0002]]],


        [[[-0.1748,  0.1687, -0.1289, -0.1233, -0.1740],
          [-0.1290,  0.0891, -0.1593, -0.0697,  0.1464],
          [ 0.1105, -0.1485, -0.0491, -0.0928,  0.1102],
          [-0.1722, -0.0370, -0.1460,  0.1000, -0.0978],
          [-0.0606,  0.0799,  0.1825, -0.0336,  0.0927]]],


        [[[ 0.0854, -0.0490, -0.0063, -0.1151, -0.0832],
          [-0.0907,  0.0464, -0.1931,  0.1807, -0.1411],
          [ 0.1717, -0.1093,  0.0028,  0.0383, -0.0214],
          [ 0.0869, -0.0650, -0.0495, -0.1145, -0.1160],
          [-0.1879, -0.0775,  0.0706,  0.0891, -0.0320]]],


        [[[ 0.1233, -0.1302,  0.0550, -0.0352, -0.0478],
          [ 0.1198, -0.0527,  0.0445, -0.1290,  0.1794],
          [ 0.1934,  0.1723, -0.0695, -0.0478,  0.1319],
          [-0.1266,  0.0553,  0.1986,  0.0863, -0.1902],
          [-0.0781, -0.1702,  0.1550, -0.0495,  0.0431]]],


        [[[-0.1568, -0.0720, -0.0835,  0.0141, -0.1801],
          [-0.1789,  0.0412, -0.1412, -0.0270,  0.1074],
          [ 0.1754, -0.0252, -0.1771,  0.1943,  0.1151],
          [-0.1543, -0.0640,  0.1502, -0.1354,  0.0017],
          [ 0.1535, -0.1252,  0.1030, -0.0785,  0.0483]]],


        [[[-0.0667,  0.0603, -0.0938,  0.0369, -0.0360],
          [-0.1385,  0.0589, -0.0489,  0.1817, -0.0321],
          [-0.1204,  0.1389,  0.0236, -0.1670,  0.0928],
          [-0.1413,  0.0794,  0.1880, -0.0728,  0.0097],
          [ 0.1995,  0.0622, -0.1078,  0.0297, -0.0646]]],


        [[[ 0.1937, -0.1338, -0.0996,  0.0199,  0.1286],
          [ 0.0292,  0.0062, -0.0187, -0.0364, -0.1430],
          [ 0.1164, -0.1209,  0.1628, -0.1620,  0.1178],
          [-0.1751, -0.1658, -0.1979, -0.0599, -0.1131],
          [-0.0113,  0.0823,  0.0264,  0.0607, -0.1682]]],


        [[[ 0.1806,  0.1261, -0.1096, -0.0347, -0.0464],
          [-0.1393, -0.0848,  0.1456,  0.0846, -0.0371],
          [ 0.1387,  0.0991,  0.0368,  0.1163, -0.1433],
          [-0.1353,  0.0932,  0.0403, -0.0580, -0.0377],
          [-0.0581,  0.1776,  0.1512,  0.0292,  0.1073]]],


        [[[ 0.0192,  0.0831,  0.0970, -0.0602, -0.0959],
          [ 0.1646, -0.1936,  0.0584,  0.0601, -0.1540],
          [-0.0022, -0.1373, -0.1468, -0.1663,  0.0038],
          [-0.0141,  0.1785,  0.1396, -0.0135,  0.0086],
          [ 0.1366,  0.1135,  0.0218, -0.1360, -0.1312]]]], requires_grad=True))
script model param 0: 
('conv1.bias', Parameter containing:
tensor([-0.0608,  0.1971, -0.0097, -0.1209, -0.1492, -0.0995,  0.1368,  0.0363,
        -0.1585,  0.1480], requires_grad=True))
```

cc @suo