In Tensorflow convolution:

y = np.random.rand(1,100,100,1)
filterx = np.random.rand(5,5,1,1)
a= tf.nn.conv2d(
    y,
    filterx, [1,1,1,1], 'VALID')
print(sess.run(a))


In pytorch , for same input and weights:

x = torch.nn.Conv2d(1,1,5, bias = False)
filter = np.transpose(filterx, (2,3,1,0))
x.weight = torch.nn.Parameter(torch.from_numpy(filter))
z = np.transpose(y, (0,3,1,2))
l = x(torch.from_numpy(z))
l = l.detach().numpy()
l = np.transpose(l,(0,2,3,1))


Both l and a variable should have same o/p, but its not. Why convolution behavior is different in tensorflow and pytorch?