File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -240,6 +240,14 @@ def get_device_ptr(a):
240240 return ptr
241241
242242def lock_device_ptr (a ):
243+ """
244+ This functions is deprecated. Please use lock_array instead.
245+ """
246+ import warnings
247+ warnings .warn ("This function is deprecated. Use lock_array instead." , DeprecationWarning )
248+ lock_array (a )
249+
250+ def lock_array (a ):
243251 """
244252 Ask arrayfire to not perform garbage collection on raw data held by an array.
245253
@@ -252,10 +260,17 @@ def lock_device_ptr(a):
252260 -----
253261 - The device pointer of `a` is not freed by memory manager until `unlock_device_ptr()` is called.
254262 """
255- ptr = ct .c_void_p (0 )
256- safe_call (backend .get ().af_lock_device_ptr (a .arr ))
263+ safe_call (backend .get ().af_lock_array (a .arr ))
257264
258265def unlock_device_ptr (a ):
266+ """
267+ This functions is deprecated. Please use unlock_array instead.
268+ """
269+ import warnings
270+ warnings .warn ("This function is deprecated. Use unlock_array instead." , DeprecationWarning )
271+ unlock_array (a )
272+
273+ def unlock_array (a ):
259274 """
260275 Tell arrayfire to resume garbage collection on raw data held by an array.
261276
@@ -265,7 +280,6 @@ def unlock_device_ptr(a):
265280 - A multi dimensional arrayfire array.
266281
267282 """
268- ptr = ct .c_void_p (0 )
269- safe_call (backend .get ().af_unlock_device_ptr (a .arr ))
283+ safe_call (backend .get ().af_unlock_array (a .arr ))
270284
271285from .array import Array
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ def simple_device(verbose=False):
4848 display_func (b )
4949
5050 c = af .randu (10 ,10 )
51- af .lock_device_ptr (c )
52- af .unlock_device_ptr (c )
51+ af .lock_array (c )
52+ af .unlock_array (c )
5353
5454_util .tests ['device' ] = simple_device
You can’t perform that action at this time.
0 commit comments