Cuda oom when calculating loss function

Error says that creating this tensor requires 5gb of GPU memory.
What are the shapes of pred and gold?