Error too many indices for tensor of dimension 1

Hallo everyone, i’m encountering a problem with my code…
It said IndexError: too many indices for tensor of dimension 1 while i executed

def plot_img_with_bbox(path: str) -> Image:
    """Show image with all of the bounding box from JPG Path
    path: str=Path of jpg file

    Return
      Image=Image that already have been drawen with bounding box
    """
    path_xml, path_jpg = xml_and_jpg(path)
    sample_image = Image.open(path_jpg)
    sample_annotations, sample_labels = get_annotations_and_labels(path_xml)
    tensor_image = (transforms.ToTensor()(sample_image) * 255).to(torch.uint8)
    tensor_annotations = torch.tensor(sample_annotations)

    dict_color = {"other": "black", "LD": "yellow", "H": "green", "HD": "red"}
    colors = [dict_color[x] for x in sample_labels]
    torch.Size([1, 4])
    img = draw_bounding_boxes(
        tensor_image,
        boxes=tensor_annotations,
        labels=sample_labels,
        width=3,
        colors=colors,
    )
    view_image = transforms.ToPILImage()(img)
    return view_image

plot_img_with_bbox(list_unique_path[0])

How can i solve this problem?
Thanks in advance guys