This change replaces references to a number of deprecated NumPy type aliases (np.bool, np.int, np.float, np.complex, np.object, np.str) with their recommended replacement (bool, int, float, complex, object, str).
NumPy 1.24 drops the deprecated aliases, so we must remove uses before updating NumPy.
PiperOrigin-RevId: 495851585
The function expects device strings to be upper-case ('GPU' instead of 'gpu', etc) and silently fails when used with an empty device list and a lower-case device identifier.
PiperOrigin-RevId: 382547669