Commit bd780795 by lixiaoquan Committed by Tianqi Chen

[RELAY] Fix get_int_tuple for shape like '(1001,)' (#2691)

tshape.strip('()[]').split(',') will make a list ['1001',''] but the empty one isn't needed.
parent 2bf34581
...@@ -106,7 +106,7 @@ class StrAttrsDict(object): ...@@ -106,7 +106,7 @@ class StrAttrsDict(object):
""" """
if key in self.attrs: if key in self.attrs:
tshape = self.attrs[key] tshape = self.attrs[key]
return tuple(int(x.strip()) for x in tshape.strip('()[]').split(',')) return tuple(int(x.strip()) for x in tshape.strip('()[]').split(',') if x)
if isinstance(default, RequiredAttr): if isinstance(default, RequiredAttr):
raise AttributeError("Required attribute {} not found.".format(key)) raise AttributeError("Required attribute {} not found.".format(key))
return default return default
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment