Use the name() method on Module perhaps? It relies on RTTI to resolve the type name. This is the same function that pretty_print() uses to get the module name.
https://pytorch.org/cppdocs/api/classtorch_1_1nn_1_1_module.html#_CPPv4NK5torch2nn6Module4nameEv 4