UserWarning: indexing with dtype torch.uint8 is now deprecated, please use dtype.torch.bool instead,

I am get this error;

UserWarning: indexing with dtype torch.uint8 is now deprecated, please use dtype.torch.bool instead.
It is located in IndexingUtils.h:20
It is not my code. How do I fix this?

Hi,

This is just a warning, not an error.
This happens because we used to have only uint8 type to represent boolean and were using them as masks.
Now that we introduced bool dtype for that purpose, we are deprecating the use of uint8 as a bool.

You can remove it by changing your uint8 Tensor to a boolean one before using it as a mask when indexing.