I was wondering why this happens:
n = nn.Conv2d(1, 1, 2, stride=1)
n.weight = nn.Parameter(torch.from_numpy(np.random.randint(low=0, high=5, size=(1,1,2,2)).astype(np.float32)))
inp = Variable(torch.from_numpy(np.random.randint(low=0, high=5, size=(1, 1,3,3)))).float()
n.weight
Parameter containing:
(0 ,0 ,.,.) =
4 2
0 1
[torch.FloatTensor of size 1x1x2x2]
inp
Variable containing:
(0 ,0 ,.,.) =
1 1 3
2 3 1
4 0 4
[torch.FloatTensor of size 1x1x3x3]
n(inp)
Variable containing:
(0 ,0 ,.,.) =
9.1881 11.1881
14.1881 18.1881
[torch.FloatTensor of size 1x1x2x2]
Where are the decimal places coming from? Is there something that I’m not getting here?