Ensured the needed gradOutputBuffer size.