fix clip bug.
Added tests for the other way around as well.
fixed the unit tests.
Added the comments.
Merge pull request #2225 from caglar/fix_grad_clip

Fixes #633