import torch


def surround(idx_vector, start_idx, end_idx):
    """Surround the vector by start_idx and end_idx."""
    start_tensor = idx_vector.new_tensor([start_idx])
    end_tensor = idx_vector.new_tensor([end_idx])
    return torch.cat([start_tensor, idx_vector, end_tensor], 0)