by default requires_grad is false
input1 can be used as is. input2 should become input2.requires_grad_().
the migration guide explains this better! https://pytorch.org/2018/04/22/0_4_0-migration-guide.html 130