Making a custom layer in keras that reshapes in a sliding window fashion

Viewed 16

So I was trying to make a custom layer similar to the reshape layer in keras that can reshape the data but with the shifting index, in a sliding window fashion.

For example my input is currently in the shape of (some length, some dimension) i.e. (1000,3) and I want it to be (1000,5,3) where 5 is the time steps. [![sliding window input shape][1]][1]

I have the code already written for that purpose but I when I call that code inside the custom layer code, it takes awfully long and I am pretty sure it's is because I am not using the call function in a way that I am supposed to. [1]: https://i.stack.imgur.com/s3JzJ.png

0 Answers
Related