You could either hold on to the OneVsAll object and change its target_category member or just keep track of a target_category in the dataset, use it in __getitem__ and change that when you want to have a different category.
That said, if you prefer not to modify the dataset, you could also just return the category and do the comparison cat == target_cat on the cat Tensor in the training loop itself and claim that you’re following Explicit is better than implicit Python-Zen.
Best regards
Thomas