Skip to content

Commit

Permalink
Special case sequence space without elements to make tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
bartvm committed Jul 31, 2017
1 parent bbb5deb commit 8eae98d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion autograd/container_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ def __init__(self, value):
self.shape = [vspace(x) for x in value]
self.size = sum(s.size for s in self.shape)
self.sequence_type = type(value)
self.lib = vspace(value[0]).lib
if value:
# If this a list without elements, we'll just not set the
# library; there's a chance this space is nested and that
# this won't be needed. Otherwise it'll crash later
self.lib = vspace(value[0]).lib
assert self.sequence_type in (tuple, list)

def zeros(self):
Expand Down

0 comments on commit 8eae98d

Please sign in to comment.