Solved by tom in post #2 
              
              
                For pytorch 0.3.1, the forward uses Tensors, but the backward uses Variables, so use ctx.saved_variables instead of ctx.saved_tensors. 
On master (the documentation of which you link) it is ctx.saved_tensors again. 
Best regards 
Thomas