update:
the error disappears when using an input data of different size. For example, code below works fine:
net = nn.Conv2d(1, 1, kernel_size=3, stride=1, padding=1)
net = net.cuda()
x1 = Variable(torch.FloatTensor(1, 1, 256, 256).normal_()).cuda()
x2 = Variable(torch.FloatTensor(1, 1, 256, 256).normal_()).cuda()
target = Variable(torch.FloatTensor(1, 1, 256, 256).fill_(1)).cuda()
criterion = nn.BCEWithLogitsLoss()

y = net(x1)
net.zero_grad()
y.backward(target, create_graph=True)

alpha = 1e-4
w = net.weight - alpha*net.weight.grad
b = net.bias - alpha*net.bias.grad
z = F.conv2d(x2, w, b, stride=1, padding=1)
net.zero_grad()
z.backward(target)