Gradient checking code for full networks

This pull request implements the code for checking gradients computed in the backward pass against finite differences computed using the forward pass only. It makes testing of new layers and enhancements to the library easier.