Load saved TorchScript model as regular nn.Module

I would like to load a TorchScript model file (ie saved using torch.jit.save) into a regular torch.nn.Module. IE, rather than have

my_recursive_script_module = torch.jit.load(model_path)

I’d have:

my_nn_module = some_function(model_path)

Is this possible? I would think it would be straightforward, since TorchScript models are essentially a restricted subset of torch models, but it’s not working.

I’m not aware of this “inverse” operation to revert the scripting and create a Python model from the scripted one, but you might be able to manually restore the model based on the graph.