Convert text from print(model) back to a neural network

Hey PyTorch community,

Nice to meet you all here! I got an interesting task to solve…

After we build the network using class Net(nn.Module), we could display the network by using print(model) as shown in Tutorial of Build the Neural Network.

I would like to know whether there is any PyTorch function which could convert back the text generated from print(model) to a PyTorch code of neural network? Let’s neglect the forward pass at this moment…

Many thanks for your help!

Cheers,
Sven