Solved by dcaffo98 in post #2 
              
              
                I’m trying  transformer without teacher forcing for time series prediction and I came out with this snippet. Theoretically it works fine, but it’s tremendously slow and it keep crashing due to cuda running out of memory as soon as I use a batch size greater than 3,4 samples. 
# src shape is [n_batch…