Torch operation does not save type Parameter

If we attempt to do this:

A = nn.Conv1d(100,50,3)
B = nn.Conv1d(50,100,3)

A.weight = B.weight.t()

We get an error:

TypeError: cannot assign 'torch.FloatTensor' as parameter 'weight' (torch.nn.Parameter or None expected)

The problem is that B.weight.t() returns a Tensor, even though B.weight is a parameter.

I’m running on master branch. Any thoughts?

Why not using this?

A.weight.data = B.weight.t().data

Would this bind the data between the two modules?