import tensorflow as tf
from tensorflow.keras import layers
tf.random.set_seed(21)
vec = tf.random.normal([1, 2, 4], dtype=tf.float32)
print(vec)
lstm = layers.SimpleRNN(3)
output = lstm(vec)
print(output)
output-
tf.Tensor(
[[[-2.0809765 1.7485927 0.7655805 -1.5298417 ]
[-1.1606345 -1.9904611 -0.8419037 0.02641571]]], shape=(1, 2, 4), dtype=float32)
tf.Tensor([[ 0.89376044 0.8860847 -0.5505087 ]], shape=(1, 3), dtype=float32)
As we know that RNN cell takes vector as an input at each time step. How a matrix is given input to a RNN cell at each time step (In what way it is internally working or converting this matrix for each time step)?
My assumption is that it should throw an error because there should be 3 rows corresponding to each time step .i.e input shape should be (1, 3, 4).