C++ Frontend: Dynamic runtime network definitions?

It appears the typical way you’d create a network is to create a struct that extends torch::nn::module, with members of the various submodules that are part of it. Obviously you can’t dynamically generate a struct with these members, so that’s kind of off the table.

Is there any other way to dynamically generate a model at runtime? Imagine calling a function that adds another layer to your top level module somehow. It’s possible to create a list of modules with torch::nn::ModuleList, and then create individual modules to push_back into it at runtime, but again stuck at the creation of the struct / forward function.

I realize the answer to this is probably not but maybe there are some crazy C++ wizards out there who know things I don’t