Hi,
For your first question, no there is no way at the moment. But it is quite “obvious” which function won’t give you usefull gradients. In particular functions that are piecewise constant (rounding, indexing etc) will give an almost always zero gradient and so won’t be useful.
For your second question: the autograd engine is based on the chain rule:
If you have f and g two differentiable functions, and you do y=f(x) and z=g(y), then you have dx/dz = dx/dy * dy/dz.
You can apply this multiple times until each derivative is only computed for an “elementary” function.
Then you simply need to implement the derivatives of these elementary functions and you get the derivative for the whole succession of functions.
So the gradients computed by pytorch will alway be correct as long as the condition above “f and g are differentiable” is valid. If they are not, it can break (or not break) in many unexpected ways and hells ensues 
In practice it should behave properly for these cases as well but you can find single points where the computed gradient will be wrong (and we cannot detect that automatically…)