在 Keras 中实现反对称 RNN
Implementing AntisymmetricRNN in Keras
我正在尝试实现本文中描述的 AntisymmetricRNN:https://arxiv.org/abs/1902.09689。
在 Keras 工作,我想我必须实现自己的层,所以我已经阅读 https://keras.io/layers/writing-your-own-keras-layers/. Instead of starting from a plain layer as explained there, I reckon the best would probably be to extend one of the existing RNN, but Keras has
- RNN
- SimpleRNNCell
- 简单RNN
文档对于我这种水平的人来说不够详细 类 do/are,因此我很难弄清楚应该从哪里开始。
非常感谢任何帮助,包括从哪里开始和实际需要注意什么,以及各种建议。谢谢。
在 Keras 中,所有循环层都是 RNN
个具有特定 Cell
的层。
定义为RNN(cell=someCell)
所以,LSTM
层遵循同样的原则,LSTM(units=...)
层等于RNN(cell=LSTMCell(units=...), ...)
层。
就是说,要实现您的循环层(如果它不逐步破坏循环流或跳转步骤),您需要实现自己的单元格。您可以研究 LSTMCell 代码中发生的事情,将其与论文进行比较,并根据需要调整权重和公式。
因此您将拥有自己的 RNN(cell=yourCell)
。
我正在尝试实现本文中描述的 AntisymmetricRNN:https://arxiv.org/abs/1902.09689。
在 Keras 工作,我想我必须实现自己的层,所以我已经阅读 https://keras.io/layers/writing-your-own-keras-layers/. Instead of starting from a plain layer as explained there, I reckon the best would probably be to extend one of the existing RNN, but Keras has
- RNN
- SimpleRNNCell
- 简单RNN
文档对于我这种水平的人来说不够详细 类 do/are,因此我很难弄清楚应该从哪里开始。
非常感谢任何帮助,包括从哪里开始和实际需要注意什么,以及各种建议。谢谢。
在 Keras 中,所有循环层都是 RNN
个具有特定 Cell
的层。
定义为RNN(cell=someCell)
所以,LSTM
层遵循同样的原则,LSTM(units=...)
层等于RNN(cell=LSTMCell(units=...), ...)
层。
就是说,要实现您的循环层(如果它不逐步破坏循环流或跳转步骤),您需要实现自己的单元格。您可以研究 LSTMCell 代码中发生的事情,将其与论文进行比较,并根据需要调整权重和公式。
因此您将拥有自己的 RNN(cell=yourCell)
。