In general, scripting requires you to modify your input program so that it only uses the features that torch.jit.script supports. Take a look at the TorchScript Language Reference 23 for more information.