PyTorch: TypeError: only integer tensors of a single element can be converted to an index

I have:

print(f"inp: {inp.size()}\tleft_end_indices: {left_end_indices.size()}\tself.side_length: {self.side_length}")
left_remain_input = inp[:,left_end_indices + 1:left_end_indices + 1 + self.side_length]

which has the sizes:

inp: torch.Size([16, 1544, 161])        left_end_indices: torch.Size([16])      self.side_length: 48

But the error I get:

TypeError: only integer tensors of a single element can be converted to an index

Basically, I want to set left_remain_input to be portions of inp based on where the left_end_indices are in the second dimension. How can I accomplish this with PyTorch?