I’m glad it works for you.
I would suggest to set the number of input channels to 1 for easy debugging / understanding.
Maybe there is another way, as I’m not really happy to use unfold twice, so let me know, if this code is not fast enough for your use case. There might be some tweaks I’m not thinking of.