tf.nnのrnnが将来使えなくとのことなので、tf.kerasに変えたいのですがinitial_stateの引数の部分がよくわかりません。
以下が変えたいコードです。
python
1X = tf.placeholder(tf.float32, (None, None, input_size)) 2hidden_layer = tf.placeholder(tf.float32, (None, 2 * size_layer)) 3cell = tf.nn.rnn_cell.LSTMCell(size_layer, state_is_tuple = False) 4rnn,last_state = tf.nn.dynamic_rnn(inputs=X, cell=cell, 5 dtype=tf.float32, 6 initial_state=hidden_layer)
自分が考えた変換コードは以下です。
python
1X = tf.placeholder(tf.float32, (None, None, input_size)) 2hidden_layer = tf.placeholder(tf.float32, (None, 2 * size_layer)) 3rnn = tf.keras.layers.LSTM(size_layer,return_state=True)(X) 4last_state = rnn[1::] 5rnn = rnn[0]
よろしくお願いします。

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。