Viewing a single comment thread. View all comments

duck_mopsi t1_j6ibwq0 wrote

I am trying to create a GAN with RNNs. Therefore I'm trying to create stacked GRU-Cells which get fed the random input. I implemented it as follows:

def build_generator():
    inputs = keras.Input(shape=[LATENT_SHAPE])
    cell = keras.layers.StackedRNNCells([keras.layers.GRUCell(64, activation = 'tanh') for _ in range(7)])
    rnn = keras.layers.RNN(cell, return_sequences=True)
    x = rnn(inputs)
    return keras.models.Model(inputs, x)

However everytime I try to call the method, I do get the following error:

Error

I have found basically the same implementation for StackedRNNCells in the second to newest push from TimeGAN. Yet for me I get the error, I don't know how to fix.

1

duck_mopsi t1_j6iksqy wrote

Welp, it seemed like the problem was, that the inputs need to be defined as 2-dimensional with the sequence length as the first parameter. I thought one would give the RNN only 1 dimension of latent noise and get the sequence through reiterating it trough the RNN.

1