What is torch.fx?

I just read about some of the new features of PyTorch 1.8 and noticed the introduction of the torch.fx module. I read the documentation and I kind of get what it does but I have two questions:

  • What are the use cases?
  • Does it allow to do something that was previously impossible on PyTorch or is it just about improving performances?
  • Is there a particular area of machine learning where it could be useful?

Thank you!


It can be useful when writing a framework that does automatic model modifications, whether it is for improving performance accuracy or just hardware support. That wasn’t possible before.

Thank you! Can you link me any GitHub project that exemplifies it well?