I am printing the tensor shapes, they are all as expected. The code works fine when I run it on 1 GPU. But with multiple GPUs, I get this error. Plus, this error happens with the last batch of training. It works fine with all the previous batches. I am printing the gradient of embeddings layer, it shows that there is a non zero gradient as well.