06_03_qa_analysis.ipynb: could not broadcast input array
alandplm opened this issue · comments
I found the following error while running 06_03_qa_analysis.ipynb
:
ValueError Traceback (most recent call last)
<ipython-input-24-4b8575d1c9c7> in <module>()
28 counter += 1
29
---> 30 word_preds, next_decoder_init_state = question_model.predict([word_tokens, next_decoder_init_state])
31
32 next_decoder_init_state = np.squeeze(next_decoder_init_state, axis = 1)
4 frames
/usr/local/lib/python3.6/dist-packages/numpy/core/_asarray.py in asarray(a, dtype, order)
83
84 """
---> 85 return array(a, dtype, copy=False, order=order)
86
87
ValueError: could not broadcast input array from shape (200) into shape (1)
The proposed solution is to add word_tokens = np.array(word_tokens)
to the following code snippet:
...
ended = False
counter = 0
word_tokens = np.array(word_tokens) # add this line
while not ended:
...