Solved by albanD in post #2 
              
              
                Hi, 

Yes a lot of memory is kept until the backward call because its content is needed for the backward call computations.
You can use the checkpointing tool to trade compute for memory: this will slow down the backward but reduce the memory usage.