I am using version 1.6 of pytorch. And I am getting this error for using grad manually
“RuntimeError: Trying to backward through the graph a second time, but the saved intermediate results have already been freed. Specify retain_graph=True when calling backward the first time.”