- Notifications
You must be signed in to change notification settings - Fork64
Closed
Milestone
Description
There appears to be some issue regarding the interoperability between numpy and arrayfire-python regarding certain data types.
I did the conversion using the methods:
# numpy to arrayfireaf.interop.np_to_af_array# arrayfire to numpyaf.Array.__array__()
The only two data types which appear to work as intended arefloat
anddouble
(f32
andf64
in Arrayfire,np.float32
andnp.float64
in numpy).
64 bit integer values (signed and unsigned) and bool appear to be not supported (KeyError when trying to convert), but the data typesu8
,u32
ands32
are not converted correctly.
An example:
nparr = np.array([5, 10, 15, 20, 25, 30], np.int)print(nparr)# Output: [ 5 10 15 20 25 30]afarr = af.interop.np_to_af_array(nparr)print(afarr)# Output:# arrayfire.Array()# Type: long int# [6 1 1 1]#42949672965 #85899345935 #128849018905 # -7780732514909268839 #0#0afarr += 10print(afarr.__array__())# Output: [25 10 35 20 45 30] instead of [25, 30, 35, 40, 45, 50]# Ten was only added to every second value!
I tried these conversions with all of the aforementioned datatypes
I am using ArrayFire v3.3.2 (buildf65dd97) with Python 3.5.2 on 64bit Windows
Metadata
Metadata
Assignees
Labels
No labels