Hi, you can use torchviz and look at the graph itself:
torchviz.make_dot(y, show_saved=True, show_attrs=True)

image676×886 47.6 KB

When the computation graph is freed, the variables other and self in orange are freed.
You can learn more about how autograd works here: Google Colab 1
and here: Autograd mechanics — PyTorch master documentation 3