Open sdwfrost opened 8 years ago
Same Error here.
numpy==1.11.1 scipy==0.18.0 Theano==0.9.0.dev2
Traceback (most recent call last): File "\Anaconda3\envs\p34\lib\site-packages\theano-0.9.0.dev2-py3.4.egg\theano\compile\function_module.py", line 866, in call self.fn() if output_subset is None else\ ValueError: softmaxes.shape0 != y_lengths.shape0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/TheanoLSTM.py", line 248, in
Backtrace when the node is created(use Theano flag traceback.limit=N to make it longer):
File "/TheanoLSTM.py", line 242, in
HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.
Process finished with exit code 1
I had that error and fixed it by changing the function pad_into_matrix as follows (notice moving the list(lengths) earlier because the call to max consumes the iterator object so list(lengths) returns [] if applied after max()):
def pad_into_matrix(rows, padding = 0):
if len(rows) == 0:
return np.array([0, 0], dtype=np.int32)
lengths = list(map(len, rows))
width = max(lengths)
height = len(rows)
mat = np.empty([height, width], dtype=rows[0].dtype)
mat.fill(padding)
for i, row in enumerate(rows):
mat[i, 0:len(row)] = row
return mat, lengths
Everything goes fine until the very end
Versions of software below