Solved problems with CUDA. Added sanity check to cross-entropy loss functions