Unwrap chains of dtype-cast nodes to find the underlying value.
(node: torch.fx.Node)
| 25 | |
| 26 | |
| 27 | def _skip_casts(node: torch.fx.Node) -> torch.fx.Node: |
| 28 | """Unwrap chains of dtype-cast nodes to find the underlying value.""" |
| 29 | while node.target in _CAST_OPS: |
| 30 | arg0 = node.args[0] if node.args else None |
| 31 | if not isinstance(arg0, torch.fx.Node): |
| 32 | break |
| 33 | node = arg0 |
| 34 | # pyre-ignore[7]: node is always a Node; Pyre cannot narrow through loops |
| 35 | return node |
| 36 | |
| 37 | |
| 38 | class RmsNormMatch(PatternMatch): |
no outgoing calls
no test coverage detected