It would be really great to have scope name available on nodes in the traced graph. Reposting what @lantiga has suggested.
Something like node.scope() could return a string Foo/Bar or Foo/Bar[baz], where Foo and Bar are scope names. The second form will be generated automatically by modules, one scope name per module: in this case baz is the name of the variable containing the module Bar in the parent module Foo
class Foo(nn.Module):
def __init__(self):
[...]
self.baz = Bar()