Yolkandwhite:

My first question is in the first output, obj_ids is [0].
then how is obj_ids[1:] not have error? isn’t it out of index range?


No, as you will get an empty tensor, if the slice is invalid (same as in numpy):
x = torch.randn(10)
n = np.random.randn(10)

print(x[11:])
> tensor([])
print(n[11:])
> []

However, direct indexing will yield an error.



 Yolkandwhite:

why does obj_ids has additional space?
doesn’t it has to be [0 255] not [ 0 255]?


Numpy formats the output like this (PyTorch as well, but with a comma  ).