import torch


def add_time(paths: torch.Tensor) -> torch.Tensor:
    """Adds a time channel to a batch of multidimensional paths.

    :param paths: torch.Tensor of shape (batch, step, channel)
    :return: torch.Tensor of shape (batch, step, channel+1), where the last channel is the time normalized between 0 and 1.
    """
    t = torch.linspace(0., 1, paths.shape[1])
    paths = torch.cat([paths, t.unsqueeze(0).repeat(paths.shape[0], 1).unsqueeze(-1)], dim=2)
    return paths