Thanks a lot apaszke, I was not aware of these “functionals”.
Is this the correct way to do this convolution in a batch manner? (it runs very slow…)
    y = self.pool(F.relu(self.conv1(y)))
    z = Variable(torch.Tensor(x.size()[0], 16, 10, 10))

    for i in range(x.size()[0]):
        z[i,:]= F.conv2d(y[i,:].unsqueeze(0), x[i,:]).squeeze(0)

    z = self.pool(F.relu(z))
    z = z.view(-1, 16*5*5)

(x contains the convolutional weights, y contains the image I want to convolve over, and z is where I put the result)
Thanks