| 24 | namespace py = pybind11; |
| 25 | |
| 26 | bool InitializeNumpyAPIForTypes() { |
| 27 | // Caution: import_array1 works by initializing a static variable |
| 28 | // (PyArray_API) which is *defined* in a NumPy header. import_array1() must |
| 29 | // therefore be called from the *same translation unit* as any users of |
| 30 | // NumPy C APIs (here PyArray_View). This awkward wrapper function |
| 31 | // must not be inlined into its caller. |
| 32 | import_array1(false); |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | xla::StatusOr<PrimitiveType> DtypeToPrimitiveType(const py::dtype& np_type) { |
| 37 | static auto* types = |
no outgoing calls
no test coverage detected