Suppose we have a torch model like this
from script_class import CustomClass class Model(nn.Module): def __init__(self): super(Model, self).__init___() self.object = CustomClass() def forward(self): print('hello')
Then i script the model and save it as ‘model.pt’
Next when I load it without import CustomClass and run it, it will crash with unreadable c++ errors
How do I bake the class into the scripted model, something like torch.jit.export but for data structures?