@ptrblck yes your assumption is correct.  Can you please explain how can I do that ? Should I put weight in the loss funtion?
I am using dice loss as cost function.
class SoftDiceLoss(nn.Module):
def init(self, weight=None, size_average=True):
super(SoftDiceLoss, self).init()
def forward(self, logits, targets):
    smooth = 1
    num = targets.size(1)
    probs = (logits)
    m1 = probs.view(num, -1)
    m2 = targets.view(num, -1)
    intersection = (m1 * m2)

    score = 2. * (intersection.sum(1) + smooth) / (m1.sum(1) + m2.sum(1) + smooth)
    score = 1 - score.sum() / num
    return score