pytorch
89bd5d3d - [inductor] Implement magic methods on IR values (#101076)

Commit
1 year ago
[inductor] Implement magic methods on IR values (#101076) This wraps `ops` into an `OpsWrapper` object which wraps any returned IR values into an `OpsValue` instance. This allows magic methods to be implemented and means lowerings can write mathematical expressions much more fluently. So instead of ```python ops.add(ops.mul(ops.mul(ops.sub(ops.mul(_Ap2, x), _Ap3), x), x), _1) ``` we can write ```python (_Ap2 * x - _Ap3) * x * x + _1 ``` And it will translate to the equivalent `ops` calls. Pull Request resolved: https://github.com/pytorch/pytorch/pull/101076 Approved by: https://github.com/lezcano, https://github.com/ngimel
Author
Committer
Parents
Loading