From: François Fleuret Date: Sat, 6 Jan 2024 13:43:58 +0000 (+0100) Subject: Update. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=b458d5aa1f2ba736807e87b65ccad2f96b216a10;p=mygptrnn.git Update. --- 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 :]