小编Mad*_*ika的帖子

pruned(text): 预期参数#0(从零开始)是张量;得到清单(['烤蚂蚁是哥伦比亚的一种流行小吃'])

这是使用 EMLo 获取嵌入的代码。

import tensorflow_hub as hub

import tensorflow as tf

elmo = hub.Module("https://tfhub.dev/google/elmo/2")

x = ["Roasted ants are a popular snack in Columbia"]


embeddings = elmo(x, signature="default", as_dict=True)["elmo"] # To Extract ELMo features 

embeddings.shape
Run Code Online (Sandbox Code Playgroud)

我收到这种类型的错误,type error : pruned(text): expected argument #0(zero-based) to be a Tensor; got list (['Roasted ants are a popular snack in Columbia'])

python tensorflow

5
推荐指数
1
解决办法
578
查看次数

标签 统计

python ×1

tensorflow ×1