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

Class EtCacheWrapper

extension/llm/modules/test/test_kv_cache.py:117–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115 ) -> torch.export.ExportedProgram:
116 # Wrapper since torch.export only exports forward().
117 class EtCacheWrapper(torch.nn.Module):
118 def __init__(self, kv_cache: torch.nn.Module):
119 super().__init__()
120 self.kv_cache = kv_cache
121
122 def forward(self, k_val: torch.Tensor, v_val: torch.Tensor):
123 return self.kv_cache.update(k_val, v_val)
124
125 dim = torch.export.Dim("seq_len_dim", min=1, max=self.max_seq_len)
126 exported_kv_cache = torch.export.export(

Callers 1

export_kv_cacheMethod · 0.85

Calls

no outgoing calls

Tested by 1

export_kv_cacheMethod · 0.68