import torch


def generate_diagonal_mask(size: int) -> torch.Tensor:
    """
    Generate a diagonal mask for the sequence.
    The masked positions are filled with float('-inf').
    Unmasked positions are filled with float(0.0).
    """
    mask = torch.zeros(size, size)
    mask = mask.fill_diagonal_(1)
    mask = mask.masked_fill(mask == 0, float(
        "-inf")).masked_fill(mask == 1, float(0.0))
    return mask