def fill_padded_part(xs, ilens, fill_value):
    """Fucntion to fill padded part with selected value

    :param torch.Tensor xs: tensor (B, Tmax, ...)
    :param torch.Tensor ilens:  list of lengths (B)
    :param float fill_value:  value to fill padded part
    :return: xs whose padded parts are filled by fill_value
    """
    assert xs.size(0) == len(ilens)
    new_xs = xs.new(*xs.size()).fill_(fill_value)
    for idx, l in enumerate(ilens):
        new_xs[idx, :l] = xs[idx, :l]

    return new_xs