MCPcopy Create free account
hub / github.com/pytorch/executorch / _skip_casts

Function _skip_casts

backends/vulkan/patterns/rms_norm.py:27–35  ·  view source on GitHub ↗

Unwrap chains of dtype-cast nodes to find the underlying value.

(node: torch.fx.Node)

Source from the content-addressed store, hash-verified

25
26
27def _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
38class RmsNormMatch(PatternMatch):

Callers 4

__init__Method · 0.85
_has_rsqrt_ancestorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected