Skip to content

Commit 17b2586

Browse files
committed
[master] some minor bug fixes
1 parent 06fd46c commit 17b2586

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

jacinle/cli/argument.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,18 @@ def __init__(self, string):
7777

7878
for i, kv in enumerate(kvs):
7979
k, v = kv.split('=')
80+
8081
if v.startswith('"') or v.startswith("'"):
8182
assert v.endswith('"') or v.endswith("'")
8283
v = v[1:-1]
83-
else:
84+
85+
try:
8486
v = float(v)
8587
if int(v) == v:
8688
v = int(v)
89+
except:
90+
pass
91+
8792
kvs[i] = (k, v)
8893

8994
self.kvs = kvs

jactorch/data/collate/__init__.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
# This file is part of NSCL-PyTorch.
99
# Distributed under terms of the MIT license.
1010

11-
12-
from .collate_v1 import VarLengthCollateV1
1311
from .collate_v2 import VarLengthCollateV2
1412
from .collate_v3 import VarLengthCollateV3
1513
from .utils import user_scattered_collate, VarLengthCollateMode
1614

17-
VarLengthCollate = VarLengthCollateV1
15+
import torch
16+
17+
if torch.__version__ <= '0.3.1':
18+
from .collate_v1 import VarLengthCollateV1
19+
VarLengthCollate = VarLengthCollateV1
20+

jactorch/data/collate/collate_v1.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
from six import string_types
2222

2323
from jacinle.utils.argument import UniqueValueGetter
24-
from .utils import numpy_type_map
25-
from .collate import use_shared_memory, numpy_type_map, VarLengthCollateMode, VarLengthCollateMode
24+
from .utils import use_shared_memory, numpy_type_map, VarLengthCollateMode, VarLengthCollateMode
2625

2726
__all__ = ['VarLengthCollateV1']
2827

jactorch/nn/mask/functional.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818

1919
def masked_softmax(logits, mask=None, dim=-1, eps=1e-20, ninf=-1e4):
20-
if logits is not None:
20+
if mask is not None:
2121
logits = logits * mask + ninf * (1 - mask)
2222

2323
probs = F.softmax(logits, dim=dim)

0 commit comments

Comments
 (0)