Test all error/gradient functions of Net.
Fix bugs, documentation and throw exceptions.