In the Module’s forward pass, you know which module you’re in, but this information is not available afterwards because the graph is saved independently of the Module iteself. So you can’t trace back from the grad_fn which module created it.