We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
is
==
1 parent 0fb74d0 commit 58c8b25Copy full SHA for 58c8b25
mlir/python/mlir/runtime/np_to_memref.py
@@ -23,13 +23,14 @@ class F16(ctypes.Structure):
23
_fields_ = [("f16", ctypes.c_int16)]
24
25
26
+# https://stackoverflow.com/questions/26921836/correct-way-to-test-for-numpy-dtype
27
def as_ctype(dtp):
28
"""Converts dtype to ctype."""
- if dtp is np.dtype(np.complex128):
29
+ if dtp == np.dtype(np.complex128):
30
return C128
- if dtp is np.dtype(np.complex64):
31
+ if dtp == np.dtype(np.complex64):
32
return C64
- if dtp is np.dtype(np.float16):
33
+ if dtp == np.dtype(np.float16):
34
return F16
35
return np.ctypeslib.as_ctypes_type(dtp)
36
0 commit comments