Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Numpy Interoperability Issues with certain datatypes #92

Closed
Milestone
@lukasbindreiter

Description

@lukasbindreiter

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp