【发布时间】:2018-01-31 05:13:03
【问题描述】:
我收到以下警告:
94: UserWarning: Converting sparse IndexedSlices to a dense Tensor with 1200012120 elements. This may consume a large amount of memory.
对于以下代码:
from wordbatch.extractors import WordSeq
import wordbatch
from keras.layers import Input,Embedding
...
wb = wordbatch.WordBatch(normalize_text, extractor=(WordSeq, {"seq_maxlen": MAX_NAME_SEQ}), procs=NUM_PROCESSOR)
wb.dictionary_freeze = True
full_df["ws_name"] = wb.fit_transform(full_df["name"])
...
name = Input(shape=[full_df["name"].shape[1]], name="name")
emb_name = Embedding(MAX_TEXT, 50)(name)
...
也就是说,我使用了 GRU 网络嵌入层的 WordSeq(来自 WordBatch)输出。我应该如何修改代码以使其在不转换为密集张量的情况下工作?
【问题讨论】:
-
你修过吗?
标签: tensorflow keras word-embedding gated-recurrent-unit