PyTorch currently provides torch.is_floating_point
and torch.is_complex
to check whether a tensor contains data of a certain numeric types. Why hasn’t an equivalent method for integers been implemented yet?
My guess is that it isn’t as widely requested as the other two, but maybe there’s a more profound reason. I’m considering opening an issue on GitHub for creating a feature request