"RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation"
- use variable.data instead of variable when requires_grad is True
e.g.
X_var.data += learning_rate * (X_var.grad/torch.norm(X_var))
X_var.data += learning_rate * (X_var.grad/torch.norm(X_var))