From b458d5aa1f2ba736807e87b65ccad2f96b216a10 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Fleuret?= Date: Sat, 6 Jan 2024 14:43:58 +0100 Subject: [PATCH] Update. --- mygpt.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mygpt.py b/mygpt.py index 33c6fee..7105e97 100755 --- a/mygpt.py +++ b/mygpt.py @@ -441,6 +441,10 @@ class KVRec(nn.Module): ############################## +# Returns a tensor with an additional index at rank win_dim, that move +# along the same dimension as dim, on a domain {0...win_size-1} + + def moving_window(x, dim, win_dim, win_size): size, stride = x.size(), x.stride() size = size[:dim] + (size[dim] - win_size + 1,) + size[dim + 1 :] -- 2.39.5