Skip to content

Commit 56897a0

Browse files
committed
Cleaning up interop.py
1 parent b619c53 commit 56897a0

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

arrayfire/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,6 @@
6060
del inspect
6161
del numbers
6262
del os
63-
del np
63+
64+
if (AF_NUMPY_FOUND):
65+
del np

arrayfire/interop.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616
"""
1717

1818
from .array import *
19-
from .data import reorder
2019

2120
try:
2221
import numpy as np
23-
AF_NP_FOUND=True
22+
from .data import reorder
23+
24+
AF_NUMPY_FOUND=True
2425

2526
def np_to_af_array(np_arr):
2627
"""
@@ -32,7 +33,7 @@ def np_to_af_array(np_arr):
3233
3334
Returns
3435
---------
35-
af_arry : arrayfire.Array()
36+
af_arr : arrayfire.Array()
3637
"""
3738
if (np_arr.flags['F_CONTIGUOUS']):
3839
return Array(np_arr.ctypes.data, np_arr.shape, np_arr.dtype.char)
@@ -55,5 +56,7 @@ def np_to_af_array(np_arr):
5556
raise RuntimeError("Unsupported ndim")
5657
else:
5758
return np_to_af_array(np.asfortranarray(np_arr))
59+
60+
from_ndarray = np_to_af_array
5861
except:
59-
AF_NP_FOUND=False
62+
AF_NUMPY_FOUND=False

0 commit comments

Comments
 (0)