Solved by ptrblck in post #5 
              
              
                You are creating the weight tensor as a LongTensor, so either call .float() on it or use floating point values via: 
with torch.no_grad():
    conv.weight = nn.Parameter(torch.tensor([[[[1., -1.],
                                               [-1., 1.]]]]))