dave vedant
dave vedant

Reputation: 717

What is the difference between `.zero_grad()` and `.zero_grad`?

I am working on neural network and I find that, with *.grad_zero() I get loss function values properly and also converge to zero. Where, with *.grad_zero (with out bracket) gives loss function values in 5 digits. (13,564.23). So, what is the difference between them? Why "()" important in FPP. Thank you.

Upvotes: 0

Views: 99

Answers (1)

jkr
jkr

Reputation: 19300

optimizer.zero_grad is a function, so you need to call it with parentheses. If you don't use the parentheses, you are just referencing the function object but never calling it.

Upvotes: 1

Related Questions