import torch


def discriminator_target(batch_size, target_type, smoothing=0.1):
    """
    Create the target labels with smoothing
    Params
        -batch_size : batch size
        -type : 'text' or 'speech'
        -smoothing : label smoothing factor
    Return
        [batch_size] tensor with target smoothed labels
    """
    target = torch.ones(batch_size).float()
    target -= smoothing
    if target_type == 'speech':
        target = 1 - target
    return target