Skip to content

Commit 63cc707

Browse files
committed
fix
1 parent 7bd7750 commit 63cc707

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

onnx_diagnostic/torch_export_patches/patches/_patch_transformers_dynamic_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def lazy_initialization(self, key_states: torch.Tensor):
2727
assert (
2828
hasattr(key_states, "shape") and key_states is not None
2929
), f"Attribute 'shape' is wrong for type {type(key_states)}"
30-
like = key_states[:, :, :0]
30+
like = torch.narrow(key_states, dim=-2, start=0, length=0)
3131
# PATCHED: used a tensor with an empty shape and not en empty list to initialize
3232
if isinstance(key_states, torch._subclasses.fake_tensor.FakeTensor):
3333
with key_states.fake_mode:

0 commit comments

Comments
 (0)