tensorlayer / chinese-book

《深度学习:一起玩转TensorLayer》资源分享、讨论
139 stars 47 forks source link

ch5 p143 line 44 无法保存模型 #16

Open arisliang opened 6 years ago

arisliang commented 6 years ago

tl.files.save_npz(emb_net.all_params, name=model_file_name + '.npz') 给出错误. 尝试用官方的例子https://github.com/tensorlayer/tensorlayer/blob/master/example/tutorial_word2vec_basic.py, 貌似也有类似的错误。

Save model, data and dictionaries!!!!!!!!!! Traceback (most recent call last): File "/home/ly/src/tl-play/ch5_word2vec.py", line 165, in tl.files.save_npz(emb_net.all_params, name=model_file_name + '.npz') File "/home/ly/anaconda3/envs/learning/lib/python3.6/site-packages/tensorlayer/files.py", line 1176, in save_npz np.savez(name, params=save_list_var) File "/home/ly/anaconda3/envs/learning/lib/python3.6/site-packages/numpy/lib/npyio.py", line 595, in savez _savez(file, args, kwds, False) File "/home/ly/anaconda3/envs/learning/lib/python3.6/site-packages/numpy/lib/npyio.py", line 693, in _savez val = np.asanyarray(val) File "/home/ly/anaconda3/envs/learning/lib/python3.6/site-packages/numpy/core/numeric.py", line 544, in asanyarray return array(a, dtype, copy=False, order=order, subok=True) ValueError: could not broadcast input array from shape (50000,128) into shape (50000)