Usually for DNN, I have the training data of matching X (2D) to Y (2D), for example, XOR data:
X = [[0,0],[0,1],[1,0],[1,1]];
Y = [[0], [1], [1], [0] ];
However, RNN seems strange, I don't get it how to match X to Y, input of RNN layer is 3D and output is 2D (rightclick to open in new tab): https://colab.research.google.com/drive/17IgFuxOYgN5fNO9LKwDijEBkIeWNPas6
import tensorflow as tf;
x = [[[1],[2],[3]], [[4],[5],[6]]];
bsize = 2;
times = 3;
#3d input
input = tf.placeholder(tf.float32, [bsize,times,1]);
cell = tf.keras.layers.LSTMCell(20);
rnn = tf.keras.layers.RNN(cell);
hid = rnn(input);
sess = tf.Session();
init = tf.global_variables_initializer();
sess.run(init);
#results in 2d
print(sess.run(hid, {input:x}));
The example data seen on https://www.tensorflow.org/tutorials/sequences/recurrent are:
t=0 t=1 t=2 t=3 t=4
[the, brown, fox, is, quick]
[the, red, fox, jumped, high]
How to map these data from X (3D input for RNN layer) to Y (2D)? (Y is 2D because RNN layer output is 2D).