Easiest way to check for a "connected" graph

Is there an easy way to check if my entire sequence of operations is connected? Apart from manually debugging through the entire flow and checking if each intermediate variable has a grad_fn? I haven’t used Tensorflow much either, but what I am looking for is probably a way to print out the entire “graph” in PyTorch (though I understand in PyTorch it’s dynamically created)?

Sorry if that didn’t make much sense. I mean if I had something like:
x = tensor which requires grad

Now I want something which tells me the entire sequence of grad_functions. The purpose is to troubleshoot a project where I have quite a long such chain of functions and hopefully I am not messing up somewhere.

Sorry this isn’t much (it’s kinda late here), but this post has a snippet that lets you examine the gradient flow, and @apaszke has a GitHub Gist that should let you see the network’s graph. Hope that helps!