这是报错的代码
def visualize(sentence):
rows, words = sentence2sequence(sentence)
mat = np.vstack(rows)
fig = plt.figure()
ax = fig.add_subplot(111)
shown = ax.matshow(mat, aspect="auto")
ax.yaxis.set_major_locator(ticker.MultipleLocator(1))
fig.colorbar(shown)
ax.set_yticklabels([""]+words)
plt.show()
visualize("The quick brown fox jumped over the lazy dog.")
visualize("The pretty flowers shone in the sunlight.")
ValueError Traceback (most recent call last)in 12 plt.show() 13 ---> 14 visualize("The quick brown fox jumped over the lazy dog.") 15 visualize("The pretty flowers shone in the sunlight.") in visualize(sentence) 1 def visualize(sentence): 2 rows, words = sentence2sequence(sentence) ----> 3 mat = np.vstack(rows) 4 5 fig = plt.figure() <__array_function__ internals> in vstack(*args, **kwargs) ~\anaconda3.1\lib\site-packages\numpy\core\shape_base.py in vstack(tup) 281 if not isinstance(arrs, list): 282 arrs = [arrs] --> 283 return _nx.concatenate(arrs, 0) 284 285 <__array_function__ internals> in concatenate(*args, **kwargs) ValueError: need at least one array to concatenate
来个大神给孩子看看吧
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)