Lunderberg commented on PR #13438:
URL: https://github.com/apache/tvm/pull/13438#issuecomment-1320766706
Hmm, I'm also wondering on the representation of `T.select`. Both it and
`T.if_then_else` are useful to use in nested chains, which are what causes the
poor formatting. If a nested sequence of `N` select/if_then_else were sugared
as a sequence of `2*N + 1` arguments, we could avoid having a lot of the
structures that get poorly formatted. So the winograd TIR example, line 37
would be formatted into ~40 flat lines, instead of the ~80 heavily indented
lines that it currently formats into.
```python
B[i, j] = T.Select(
i % 4 == 3 and j % 4 == 3,
T.float32(1),
i % 4 == 3 and j % 4 == 2,
T.float32(0),
i % 4 == 3 and j % 4 == 1,
T.float32(0),
i % 4 == 3 and j % 4 == 0,
T.float32(0),
i % 4 == 2 and j % 4 == 3,
T.float32(0),
i % 4 == 2 and j % 4 == 2,
T.float32(1),
i % 4 == 2 and j % 4 == 1,
T.float32(1),
i % 4 == 2 and j % 4 == 0,
T.float32(-1),
i % 4 == 1 and j % 4 == 3,
T.float32(-1),
i % 4 == 1 and j % 4 == 2,
T.float32(1),
i % 4 == 1 and j % 4 == 1,
T.float32(-1),
i % 4 == 1 and j % 4 == 0,
T.float32(0),
i % 4 == 0 and j % 4 == 3,
T.float32(0),
i % 4 == 0 and j % 4 == 2,
T.float32(0),
i % 4 == 0 and j % 4 == 1,
T.float32(0),
i % 4 == 0 and j % 4 == 0,
T.float32(1),
T.float32(0),
)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]