I tried it but got the following error:
  AttributeError: module 'torch' has no attribute 'no_grad'

I googled that error and found the hint to set volatile=True to all the Variable I’m using, but this also didn’t solve my problem.