You were completely right  with the right padding if  works perfectly. Too bad there is not the:

padding =‘same’

as with Keras, it would have been very useful here.
I eventually made it work and now can predict with some error a random cos like function.
Thanks again.
Have a good one