Understanding the multidimensional-nature of the data being fed to a RNN and its output Assuming we have a time-series dataset whose window_size = 30 and the batch_size = 4, which makes the overall input = 4*30 (2D). But as RNN expects 3D input, tf.expand_dims is used to make it a 3D input (as per the lecture, new inut becomes 4*30*1, where the last dimension is 1 as the example deals with a univariate time-series). 
What I don't get is that what does adding a dimension mean? Eg. what will be the element [0,0,0] of the input?

Also in keras, the typical format for fitting is  

model.fit(input, output, epochs=400)


But in an RNN sample code for time-series data, I found

model.fit(dataset, epochs=400)


where  dataset is a tf object containing the time-series data. 
Why is the input and output not given explicit  for the model to train in case of the first code? The timestamp is already included in the input in a way(in the 4*30*1 input, the 2nd dimension is supposed to be time-stamps), but how does the keras know against what output labels the input has to be trained?
I think you’re confused about what a “batch” is. A batch has a very specific definition in machine learning. 

In my experience:


Dimension 1 = number of bins or number of data points per each time step
Dimension 2 = window size, the number of time steps
Dimension 3 = batch size, the total number of examples which you’ll feed the network per training batch


Looks like this for [4,3,2]:

[[[0,1,4,3],[0,8,6,9],[9,6,7,4]],[[6,8,7,0],[1,7,7,9],[1,3,5,8]]]


4 values per time step, 3 total time steps per example, 2 examples in the batch. 

Where [0,0,0] returns 0, [3,1,1] returns 9.

Also, one friendly piece of advice - don’t think in terms of time stamps. You’re not dealing with time in an RNN. You’re dealing with steps in a sequence. The sequence can be related to time.

Edit: With respect to the tensorflow stuff, a tf.dataset object can contain both the input data and the labels for each example. The point is to make writing code easier, managing data easier etc. 

The process for training/testing is the same.