RuntimeError: volatile can only be set on leaf variables

Basically, you can only set variable.volatile = True on a variable that you just created. See this post for further explanation.
In short, you can not set volatile to True on a variable that is the result of an operation. If you want to set volatile to True, you can do it by calling output.detach_() if you don’t need to train model.

1 Like