Difference between torchscript and onnx?

Could anybody please kindly explain difference between torchscript and onnx? As far as I understand, both are the scripted formats to export PyTorch models for faster inference on devices/environments without Python dependency (please correct me if I am wrong). In which real-world use case one would prefer over the other.
Thank you!

1 Like