Skip to content

Commit 76e3a0f

Browse files
committed
Bugfix for _resetBuffers()
1 parent 03a8bb8 commit 76e3a0f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pybrain/structure/modules/module.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ def _resetBuffers(self, length=1):
5454
"""Reset buffers to a length (in time dimension) of 1."""
5555
for buffername, dim in self.bufferlist:
5656
setattr(self, buffername, zeros((length, dim)))
57+
if length==1:
58+
self.offset = 0
5759

5860
def _growBuffers(self):
5961
"""Double the size of the modules buffers in its first dimension and
@@ -92,7 +94,7 @@ def shift(self, items):
9294
if items == 0:
9395
return
9496
self.offset += items
95-
for buffername, l in self.bufferlist:
97+
for buffername, _ in self.bufferlist:
9698
buf = getattr(self, buffername)
9799
assert abs(items) <= len(buf), "Cannot shift further than length of buffer."
98100
fill = zeros((abs(items), len(buf[0])))

0 commit comments

Comments
 (0)