Skip to content

Commit 8eae98d

Browse files
committed
Special case sequence space without elements to make tests pass
1 parent bbb5deb commit 8eae98d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

autograd/container_types.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ def __init__(self, value):
6666
self.shape = [vspace(x) for x in value]
6767
self.size = sum(s.size for s in self.shape)
6868
self.sequence_type = type(value)
69-
self.lib = vspace(value[0]).lib
69+
if value:
70+
# If this a list without elements, we'll just not set the
71+
# library; there's a chance this space is nested and that
72+
# this won't be needed. Otherwise it'll crash later
73+
self.lib = vspace(value[0]).lib
7074
assert self.sequence_type in (tuple, list)
7175

7276
def zeros(self):

0 commit comments

Comments
 (0)