动态图有 batch 接口吗?
Created by: Halfish
我想要拿到一个句子的 ernie 向量表示,但是发现首页给出的接口只支持单个句子,这样的话跑起来有点慢,想问下这个支持 batch 接口吗?
ids, _ = tokenizer.encode('hello world')
ids = D.to_variable(np.expand_dims(ids, 0)) # insert extra `batch` dimension
pooled, encoded = model(ids) # eager execution
print(pooled.numpy()) # convert results to numpy