I am getting the following error while experimenting with a simple lstm layer. The forward propagation is fine but while computing loss.backward() I am getting the following error.

raise RuntimeError(‘Gradients aren’t CUDA tensors’)
RuntimeError: Gradients aren’t CUDA tensors

any suggestions about why I am doing wrong?