I ran the same code with PyTorch v0.4, the result seems to be normal for both:
return x, x

and
return x, x1

Gradients are all properly calculated than returning a “None” for nn.DataParallel() wrapped NN4.