import torch


def timestamp_subtract(ts1, ts2):
    """Subtracts two timestamps

    Timestamps are represented as a torch.Tensor of shape (2,), where the first element
    corresponds to seconds and the second element corresponds to nanoseconds.

    Args:
        ts1: First timestamp
        ts2: Second timestamp

    Outputs:
        Result of ts1 - ts2 represented as a timestamp
    """

    assert ts1.shape == torch.Size([2])
    assert ts2.shape == torch.Size([2])
    return ts1 - ts2