[MLIR:Python] Make DenseElementsAttr.get() only request a buffer format if no...
[MLIR:Python] Make DenseElementsAttr.get() only request a buffer format if no explicit type was provided. 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
parent
c9ef33e1
Please register or sign in to comment