pytorch
6f46716e - Fix/skip CSE tests on Python-3.8 without `astunparse` (#101805)

Commit
1 year ago
Fix/skip CSE tests on Python-3.8 without `astunparse` (#101805) If `astunparse` is not installed, following guard will be generated in `test_guard_function_builder_with_cse`: ```python def ___make_guard_fn(): def guard(L): if not (x[0].a < x[1].a * (3 - x[2].a)): return False if not (a.b.c[0].d.e + a.b.c[1].d.e * a.b.c[2].d.e > 0): return False if not (f(m.n[0], '0').x.y.z * f(m.n[0], '1').x.y.z * f(m.n[0], '2').x.y.z < 512): return False if not (self.g(a, b).k + (1 - self.g(a, b).k) <= m[0].a + self.g(a, b).k): return False return True return guard ``` Though, I have to say, hardcoding string comparison is pretty weird. Also, skip `test_guards_cse_pass_[single|multiple]` if AST unparsing is missing. Fixes failure in a test introduced by https://github.com/pytorch/pytorch/pull/98488 copilot:poem Pull Request resolved: https://github.com/pytorch/pytorch/pull/101805 Approved by: https://github.com/atalman, https://github.com/ysiraichi
Author
Committer
Parents
Loading