文本蕴含例子运行代码报错

文本蕴含例子运行代码报错,第1张

这是报错的代码
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

 来个大神给孩子看看吧

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/716057.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-25
下一篇 2022-04-25

发表评论

登录后才能评论

评论列表(0条)

保存