def dice_coeff(pred, target):
    smooth = 1.
    num = pred.size(0)
    m1 = pred.view(num, -1).float()  # Flatten
    m2 = target.view(num, -1).float()  # Flatten
    intersection = (m1 * m2).sum().float()

    return (2. * intersection + smooth) / (m1.sum() + m2.sum() + smooth)

in the code above i am trying to calculating  dice coefficient for segmetnation task
but it resturn tensor value instead of the value of similrty
train dice tensor(3.2344e-05, device=‘cuda:0’)