Suppose I'd like to compute the element-wise quotient between two tensors. If one of the tensors contains NaNs, the resulting quotient will also contain NaNs, and this I understand. But why does the gradient becomes non-existent for the entire operation? And how can I preserve the gradient for the non-NaN entries?

For example:

```
>>> x = torch.tensor([1.0, np.NaN])
>>> y = torch.tensor([2.0, 3.0])
>>> z = torch.div(y, x)
>>> z
tensor([2., nan])
>>> z.backward()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/torch/tensor.py", line 107, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph)
  File "/usr/local/lib/python3.6/dist-packages/torch/autograd/__init__.py", line 93, in backward
    allow_unreachable=True)  # allow_unreachable flag
RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn

```