But here comes another problem
I run the following code, the first iter works well, but for the second iter there comes out an error showing that the parameter.grad is a None type which means the backward failed.
"""The tirst iter"""
loss = ((input*parameter).abs()-1).abs().sum()
loss.backward()
parameter = parameter - (0.01 * Variable(parameter.grad.data, requires_grad=True, volatile=False))
"""The second iter """
loss = ((input*parameter).abs()-1).abs().sum()
loss.backward()
parameter = parameter - (0.01 * Variable(parameter.grad.data, requires_grad=True, volatile=False))