Skip to content

Commit 48a247a

Browse files
committed
converting float to int (py3 automatically converts division result to best fitting type)
1 parent 63f7f10 commit 48a247a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

utils/tools.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def minibatch(l, bs):
2121
will output:
2222
[[0],[0,1],[0,1,2],[1,2,3]]
2323
'''
24-
out = [l[:i] for i in range(1, min(bs,len(l)+1) )]
25-
out += [l[i-bs:i] for i in range(bs,len(l)+1) ]
24+
out = [l[:i] for i in range(1, min(bs,len(l)+1))]
25+
out += [l[i-bs:i] for i in range(bs,len(l)+1)]
2626
assert len(l) == len(out)
2727
return out
2828

@@ -37,8 +37,8 @@ def contextwin(l, win):
3737
assert win >=1
3838
l = list(l)
3939

40-
lpadded = win/2 * [-1] + l + win/2 * [-1]
41-
out = [ lpadded[i:i+win] for i in range(len(l)) ]
40+
lpadded = int(win/2) * [-1] + l + int(win/2) * [-1]
41+
out = [lpadded[i:i+win] for i in range(len(l))]
4242

4343
assert len(out) == len(l)
4444
return out

0 commit comments

Comments
 (0)