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

Function find_singleton_start_pos_node

backends/vulkan/patterns/sdpa.py:104–114  ·  view source on GitHub ↗
(graph_module: torch.fx.GraphModule)

Source from the content-addressed store, hash-verified

102
103
104def find_singleton_start_pos_node(graph_module: torch.fx.GraphModule):
105 for node in graph_module.graph.nodes:
106 if is_update_cache_node(node):
107 return node.args[2]
108
109 if is_sdpa_with_kv_cache_node(node):
110 return node.args[5]
111
112 raise Exception(
113 "Could not find an instance of llama::update_cache or sdpa_with_kv_cache"
114 )
115
116
117@register_pattern_replacement("causal_sdpa")

Callers 1

Calls 2

is_update_cache_nodeFunction · 0.85

Tested by

no test coverage detected