tensorflow / tensorflow/java

Keras LSTM-RNN layer

未关闭
#274 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Java
星标
928
派生
227
PR 合并指标
30 天内没有已合并 PR

描述

Please make sure that this is a feature request. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:feature_template

System information

  • TensorFlow version (you are using): 2.3.1
  • Are you willing to contribute it (Yes/No): Yes, when able and available

Describe the feature and the current behavior/state.
There is a high-level API on Keras to LSTM layers on top of RNN that allows getting LSTM output as simple as this:

lstm_module = LSTMModule(5)   
lstm_input = tf.constant([[0.1, 0.2], [0.3, 0.4]], shape=[1, 2, 2])
lstm_output = lstm_module(lstm_input)

A definition of the LSTM Layer with Model Subclassing API from Tensorflow:

class LSTMModule(tf.keras.layers.Layer):

    def __init__(self, lstm_dims):
        super().__init__()
        self.lstm_dims = lstm_dims
        self.lstm = LSTM(lstm_dims, return_sequences=True, return_state=True)

    def call(self, inputs):
        # Forward pass
        ini_hidden_state = tf.zeros(shape=[1, self.lstm_dims]), tf.zeros(shape=[1, self.lstm_dims])
        return self.get_lstm_output(self.lstm, inputs, ini_hidden_state)

    @staticmethod
    def get_lstm_output(lstm_model, input_sequence, initial_state):
        output = lstm_model(input_sequence, initial_state=initial_state)
        hidden_states, hidden_state, cell_state = output[0], output[1], output[2]
        return hidden_states, hidden_state, cell_state

Will this change the current api? How?
This will add a new feature to tensorflow-framework module.

Who will benefit with this feature?
Anyone that requires deep learning to solve sequence classification and prediction problems and everyone who is already familiar with Keras.

Any Other info.
This feature comes from #270

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

未指定文件或测试。首先审查 issue #270,以及现有的、与 Keras 风格 LSTM/RNN 层请求相关的 tensorflow-framework API。完成的标准是确定所请求的高级 LSTM API 是否属于此仓库,并定义其实现范围。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, tensorflow
领域
machine-learning
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。