How to get registered module's name within a module Impl

Hi,
I have a module Impl consisting of various registered CNN, batch norm modules. I would like to know the way to get this module’s name in libtorch.

You could iterate all modules and get their names via:

for name, modules in model.named_modules():
    print(name)

# or
print(model.named_modules())
1 Like