If you are using a batched index tensor, you would have to either add a batch dimension to the items tensor:
items_per_category = items_per_category.unsqueeze(0).repeat(3, 1, 1)
items_per_category[batch_index.type(torch.BoolTensor)]

or you could index both dimensions by removing the : from the indexing operation.
Let me know, if I misunderstood your use case.