import torch


def get_traversals(
        vec: torch.Tensor,
        dim_i: int,
        min_value: float,
        max_value: float,
        n_samples: int
) -> torch.Tensor:
    """Given a single 1dim vector, get a batch of 1dim vectors by traversing
    `dim_i`th dimension of `vec` linearly, from `min_value` to `max_value`

    Returns
    -------
    traversals : torch.Tensor (1 more dims than `vec`)
        a batch of 1dim vectors, generated by linearly traversing `dim_i`th
        dimension of `vec`
    """
    new_values = torch.linspace(min_value, max_value, n_samples)
    traversals = torch.zeros((n_samples, len(vec)))

    for i, new_value in enumerate(new_values):
        new_vec = vec.clone()
        new_vec[dim_i] = new_value
        traversals[i] = new_vec
    return traversals