joschu / cgt

Computation Graph Toolkit
Other
628 stars 87 forks source link

Negative reshaping check not enforced sometimes #55

Closed dementrock closed 8 years ago

dementrock commented 8 years ago

The following code will crash the native backend (segmentation fault):

import cgt
x = cgt.matrix('x', dtype='i8')
y = x * x - x
z = y.reshape((-1,))
cgt.function([x], y[z])([[1]])
joschu commented 8 years ago

Fixed in f2a6cbe. Now at least it aborts with a semi-informative message

Assertion failed: (newshape[i] >= 0) && "negative size in reshape not supported" (/Users/joschu/.cgt_cache/077da6c8b3cc27164cce2ac33a2e3875_0.cpp:12)