title: changing the loss function leads to neural network returns nans
body: <p>I'm using the Deep SVDD on CIFAR10 for one-class classification. When I change the L2 norm to Lp for p&lt;1 I got nans after some epochs.</p>
  <p>It is working for loss= torch.mean((outputs - inputs)<strong>2)
  But I got nan for loss= torch.mean((abs(outputs - inputs))</strong>(0.9))</p>
  <p>The loss for each epoch is shown here:
  INFO:root:  Epoch 1/50   Time: 1.514     Loss: 84.51767029
  INFO:root:  Epoch 2/50   Time: 1.617     Loss: 82.70055634
  INFO:root:  Epoch 3/50   Time: 1.528     Loss: 80.92372467
  INFO:root:  Epoch 4/50   Time: 1.612     Loss: 79.23560699
  INFO:root:  Epoch 5/50   Time: 1.495     Loss: 77.56893951
  INFO:root:  Epoch 6/50   Time: 1.596     Loss: 75.95311737
  INFO:root:  Epoch 7/50   Time: 1.504     Loss: 74.40722260
  INFO:root:  Epoch 8/50   Time: 1.593     Loss: 72.84329010
  INFO:root:  Epoch 9/50   Time: 1.639     Loss: 71.34644287
  INFO:root:  Epoch 10/50  Time: 1.578     Loss: 69.86484253
  INFO:root:  Epoch 11/50  Time: 1.553     Loss: 68.41005692
  INFO:root:  Epoch 12/50  Time: 1.670     Loss: 66.96582977
  INFO:root:  Epoch 13/50  Time: 1.607     Loss: 65.56927887
  INFO:root:  Epoch 14/50  Time: 1.573     Loss: 64.20584961
  INFO:root:  Epoch 15/50  Time: 1.605     Loss: 62.85230591
  INFO:root:  Epoch 16/50  Time: 1.483     Loss: 61.53305466
  INFO:root:  Epoch 17/50  Time: 1.616     Loss: 60.22836166
  INFO:root:  Epoch 18/50  Time: 1.499     Loss: 58.94760498
  INFO:root:  Epoch 19/50  Time: 1.611     Loss: 57.73990845
  INFO:root:  Epoch 20/50  Time: 1.507     Loss: 56.51732086
  INFO:root:  Epoch 21/50  Time: 1.624     Loss: 55.30994400
  INFO:root:  Epoch 22/50  Time: 1.482     Loss: 54.13251587
  INFO:root:  Epoch 23/50  Time: 1.606     Loss: 52.98952118
  INFO:root:  Epoch 24/50  Time: 1.508     Loss: 51.86713654
  INFO:root:  Epoch 25/50  Time: 1.587     Loss: 50.76639069
  INFO:root:  Epoch 26/50  Time: 1.523     Loss: 49.68750381
  INFO:root:  Epoch 27/50  Time: 1.574     Loss: 48.62197098
  INFO:root:  Epoch 28/50  Time: 1.537     Loss: 47.59307220
  INFO:root:  Epoch 29/50  Time: 1.560     Loss: 46.58890167
  INFO:root:  Epoch 30/50  Time: 1.607     Loss: 45.59774643
  INFO:root:  Epoch 31/50  Time: 1.504     Loss: 44.61755203
  INFO:root:  Epoch 32/50  Time: 1.592     Loss: 43.67579239
  INFO:root:  Epoch 33/50  Time: 1.480     Loss: 42.76135941
  INFO:root:  Epoch 34/50  Time: 1.577     Loss: 41.84933487
  INFO:root:  Epoch 35/50  Time: 1.488     Loss: 40.96647171
  INFO:root:  Epoch 36/50  Time: 1.596     Loss: 40.10220779
  INFO:root:  Epoch 37/50  Time: 1.534     Loss: 39.26658310
  INFO:root:  Epoch 38/50  Time: 1.615     Loss: 38.44916168
  INFO:root:  Epoch 39/50  Time: 1.518     Loss: nan
  INFO:root:  Epoch 40/50  Time: 1.574     Loss: nan
  INFO:root:  Epoch 41/50  Time: 1.511     Loss: nan
  INFO:root:  Epoch 42/50  Time: 1.556     Loss: nan
  INFO:root:  Epoch 43/50  Time: 1.565     Loss: nan
  INFO:root:  Epoch 44/50  Time: 1.561     Loss: nan
  INFO:root:  Epoch 45/50  Time: 1.600     Loss: nan
  INFO:root:  Epoch 46/50  Time: 1.518     Loss: nan
  INFO:root:  Epoch 47/50  Time: 1.618     Loss: nan
  INFO:root:  Epoch 48/50  Time: 1.540     Loss: nan
  INFO:root:  Epoch 49/50  Time: 1.591     Loss: nan
  INFO:root:  Epoch 50/50  Time: 1.504     Loss: nan</p>
  <p>For different learning rates and output dimensions still, the network returns nan after some epochs</p>