Patched accGradParameters to avoid doing dev->host copy (CUDA)