Relation between size of a tensor and nan as result

Hi,

When I replace this code:

w1 = torch.Tensor([[np.random.randn(input1.size(2), input1.size(2)) * 5.66]])

by this code:

temp = input1.size(2)
w1 = torch.Tensor([[np.random.randn(temp, temp) * 5.66]])

the output of my program changes to nan !!!
I replace size by shape but there exists such problem.

Do you think what the problem is?

Thanks