Skip to content

Commit 690036d

Browse files
committed
Merge pull request #104 from feynmanliang/ensure_vy_nonempty
Fix `util.DataLoader` to handle `extra=0` case
2 parents 8b8f194 + dc95f2b commit 690036d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

util/DataLoader.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ function DataLoader:__init(kwargs)
2626
local num = v:nElement()
2727
local extra = num % (N * T)
2828

29+
-- Ensure that `vy` is non-empty
30+
if extra == 0 then
31+
extra = N * T
32+
end
33+
2934
-- Chop out the extra bits at the end to make it evenly divide
3035
local vx = v[{{1, num - extra}}]:view(N, -1, T):transpose(1, 2):clone()
3136
local vy = v[{{2, num - extra + 1}}]:view(N, -1, T):transpose(1, 2):clone()

0 commit comments

Comments
 (0)