来源:The Functional API
Shared layers
Another good use for the functional API are models that use shared layers. Shared layers are layer instances that are reused multiple times in the same model -- they learn features that correspond to multiple paths in the graph-of-layers.
Shared layers are often used to encode inputs from similar spaces (say, two different pieces of text that feature similar vocabulary). They enable sharing of information across these different inputs, and they make it possible to train such a model on less data. If a given word is seen in one of the inputs, that will benefit the processing of all inputs that pass through the shared layer.
To share a layer in the functional API, call the same layer instance multiple times. For instance, here's an Embedding layer shared acros

本文介绍了在Keras中使用Functional API实现共享层,特别是共享Embedding层的应用。共享层允许在模型的不同路径中复用相同的层,用于处理相似空间的输入,如共享词汇的两段文本。通过共享层,可以跨不同输入共享信息,并减少训练所需的数据量。如果在任一输入中看到某个词,都会提升所有经过共享层的输入的处理效果。
最低0.47元/天 解锁文章
2090

被折叠的 条评论
为什么被折叠?



