What's the difference between torch.nn.Module and torch.jit.ScriptModule?

The model inherited from torch.nn.Module also can be converted to TorchScript, in which case should we use torch.jit.ScriptModule instead of torch.nn.Module?

You shouldn’t inherit from torch.jit.ScriptModule, that was an old API that we replaced in v.1.2.0

See here for details

1 Like