How to feed a 4D tenstor to LSTM model?

I want to use a LSTM model to predict the future sales.

The data is like the table below.

date store family sales
01/01/2013 1 AUTOMOTIVE 0
01/01/2013 1 BABY CARE 0
01/01/2013 1 BEAUTY 1
. .
01/01/2013 2 AUTOMOTIVE 0
01/01/2013 2 BABY CARE 0
. .
01/01/2013 50 AUTOMOTIVE 0
. .
01/02/2013 1 AUTOMOTIVE 0
01/02/2013 1 BABY CARE 50
. .
01/02/2013 2 AUTOMOTIVE 500
01/02/2013 2 BABY CARE 0
. .
01/02/2013 50 AUTOMOTIVE 0
. .
. .
12/31/2015 1 AUTOMOTIVE 0
12/31/2015 1 BABY CARE 50
. .
12/31/2015 2 AUTOMOTIVE 500
12/31/2015 2 BABY CARE 0
. .
12/31/2015 50 AUTOMOTIVE 0
. .

For each day, it has 50 stores.
For each store, it has different type of family (product). (They are all in perfect order, thank God).
Last, for each type of family, it has its sales.

Here is the problem.

The dimension of input of LSTM model is (Batch_Size, Sequence_Length, Input_Dimension). It is a 3D tensor.

However, in my case, my Input_Dimension is 2D, which is (rows x columns)
rows: number of rows in one day, which is 1782
columns: number of features, which is 2 (store and family)

Is there a good way to make my data into a shape that can be fed into a LSTM model?

Thanks a lot!

I’m sure I understand the issue completely, as you are explaining to work with 2D data but also with 4D tensors. In the former case:

it seems that the batch dimension might be missing and you should be able to add it into dim0.

He wants to push a hierarchical dataset into a RNN, like it is a magic black box.

Technically, data has to be converted to wide dense format (num of features = num stores * num families). But I doubt that the resulting model will be good… well maybe with big capacity and poisson loss it will output values in reasonable ranges, but that’s about it.