Keras Utility&Layer Collection.
kulc的Python项目详细描述
Keras实用程序和层集合[WIP]
主框架中缺少的路缘石自定义层的集合。这些层可能有助于使用keras复制当前最先进的深度学习论文。
应用程序
使用此库,以下研究论文已在Keras中重新实现:
实现层概述
目前,Keras Layer Collection
提供以下层/功能:
- Scaled Dot-Product Attention
- Multi-Head Attention
- Layer Normalization
- Sequencewise Attention
- Attention Wrapper
缩放点积注意
Implementation as described in Attention Is All You Need。通过比较查询Q
和键K
,对值V
执行非线性转换。下图摘自上述论文。
多头注意
Implementation as described in Attention Is All You Need。这基本上只是一堆aScaled Dot-Product Attention块,其输出与线性转换相结合。下图摘自上述论文。
层规范化
Sequencewise Attention
This layer applies various attention transformations on data. It needs a time-series of queries and a time-series of values to calculate the attention and the final linear transformation to obtain the output. This is a faster version of the general attention technique. It is similar to the ^{
注意包装纸
The idea of the implementation is based on the paper Effective Approaches to Attention-based Neural Machine Translation。这个层可以包裹在Keras
中的任何RNN
周围。它计算前一个输出步骤和所有输入步骤之间的注意力向量。这样,就为RNN
构造了一个新的基于注意力的输入。这个输入最终被输入到RNN
。这种技术类似于本文中描述的input-feeding
方法。下图摘自上述论文。