mirror of
https://github.com/intel/llvm.git
synced 2026-01-15 04:17:17 +08:00
Not every NumPy type (e.g., the `ml_dtypes.bfloat16` NumPy extension type) has a type in the Python buffer protocol, so exporting such a buffer with `PyBUF_FORMAT` may fail. However, we don't care about the self-reported type of a buffer if the user provides an explicit type. In the case that an explicit type is provided, don't request the format from the buffer protocol, which allows arrays whose element types are unknown to the buffer protocol to be passed. Reviewed By: jpienaar, ftynse Differential Revision: https://reviews.llvm.org/D155209