Slicing “out of bounds” will return an empty tensor, which is expected.
It seems you are forwarding targets, not labels to get_scores and calculate labels as:
labels = targets[i:i+batch_size]

Could you check the shape of targets before the slicing operation and labels afterwards?