Skip to content

Commit

Permalink
[ATTR] More robust attr parsing (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen committed May 29, 2018
1 parent 2d4ae5e commit 71a7618
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 0 additions & 2 deletions nnvm/include/nnvm/tuple.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ class Tuple {
if (it != begin) os << ',';
os << *it;
}
// python style tuple
if (t.ndim() == 1) os << ',';
os << ']';
return os;
}
Expand Down
12 changes: 11 additions & 1 deletion nnvm/python/nnvm/top/attr_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,17 @@ def get_bool(self, key):
value : bool
The result value
"""
return self[key] != "False"
lowercase = self[key].lower()
if lowercase == "1":
return True
elif lowercase == "0":
return False
elif lowercase == "true":
return True
elif lowercase == "false":
return False
else:
raise ValueError("Wrong bool format for key %s" % key)

def __repr__(self):
return str({k : self[k] for k in self.keys()})
Expand Down

0 comments on commit 71a7618

Please sign in to comment.