We proceed with the recipe as follows:
- If you want to create a one-to-one mapping, this is not an RNN but instead a dense layer. Suppose to have a model already defined and you want to add a Dense network. Then this is easily implemented in Keras:
model = Sequential()model.add(Dense(output_size, input_shape=input_shape))
- If you want to create a one-to-many option, this can be achieved with RepeatVector(...). Note that return_sequences is a boolean to decide whether to return the last output in the output sequence, or the full sequence:
model = Sequential()model.add(RepeatVector(number_of_times,input_shape=input_shape)) model.add(LSTM(output_size, return_sequences=True))
- If you want to create a many-to-one option, this ...