How to check if a tensor is a CUDA or CPU tensor inside a C custom extension?

Current it seems there’s no type checking on the way into the C API/FFI.
How would i check inside the C API that a passed tensor is of a correct type (ie is_cuda)?
I can’t seem to find anything like THTensor_isCuda in the C Tensor API.
I see THCTensor_(getDevice) but it seems there’s no CPU/GPU-agnostic version.