I am a novice trying to learn Tensorflow 2.0 for a neural network.
Currently, I am stuck on the following error: 'StackedRNNCells' object has no attribute 'zero_state'.
My code:
#Preparing the data for training and testing
S_T = self.S_t_input[-1,:,0]
dS = self.S_t_input[1:, :, 0] - self.S_t_input[0:-1, :, 0]
S_t = tf.unstack(self.S_t_input[:-1, :,:], axis=0, num=2)
# Build the lstm
lstm = tf.keras.layers.StackedRNNCells([tf.keras.layers.LSTMCell(n) for n in nodes])
self.strategy, state = tf.keras.layers.RNN(lstm, S_t, initial_state=lstm.zero_state(batch_size, dtype=tf.dtypes.float32), dtype=tf.dtypes.float32)
My code is inspired by previous work conducted in Tensorflow 1.5. I tried to use get_initial_state, which resulted in even more error messages.