What are the different PyTorch op decompositions?

I see multiple op decompositions defined in PyTorch:

  • torch/_decomp/decompositions.py
  • torch/_inductor/decomposition.py
  • torch/jit/_decompositions.py

Few questions over this:

  • What is the scope of these decomposition types?
  • Does these decomposition take place in all 3 modes in PyTorch (eager, compile and lazy)?
  • Are there any limitation in decomposing an op? like is the schema of the op updated if I use a custom decomposition to decompose it to a variant of the same op? (the variant may be a custom op or a non-core Aten op)
1 Like