Dice scores metric

Why is it that my dice scores is above 1?

intersection = torch.sum(targets * predictions)
union = torch.sum(targets) + torch.sum(predictions)
dice_score = (2 * intersection + EPSILON) / (union + EPSILON)

        dice_score_total += dice_score.item() * data.size(0)
        num_samples += data.size(0)

    dice_score_average = dice_score_total / num_samples

I guess your targets might not be one-hot encoded or your predictions might not contain probabilities.