Apologies, this code block could be more clear. I use the term instances to refer to each input instance, there is no relation to any class. I could replace this term with 'record' as have the same meaning.
'Instances' is just a placeholder to iterate through all your data instances. The i value could be passed to the generate function to create each 2D array. The idea is that as you iterate through you create a 2D dataframe or numpy array for each instance.
I did not provide the exact code for this portion as it depends on the data you use, the number of time steps and the number of features. The 'generate..' function represents a method that you will have to create yourself.