Skip to content

Commit 87fdd11

Browse files
committed
FEAT: Adding additional helper library functions
- get_backend: returns name of the backend
1 parent 5ddeb97 commit 87fdd11

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

arrayfire/library.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -531,14 +531,20 @@ def set_backend(name, unsafe=False):
531531
If False, does not switch backend if current backend is not unified backend.
532532
"""
533533
if (backend.is_unified() == False and unsafe == False):
534-
raise RuntimeError("Can not change backend after loading %s" % name)
534+
raise RuntimeError("Can not change backend to %s after loading %s" % (name, backend.name()))
535535

536536
if (backend.is_unified()):
537537
safe_call(backend.get().af_set_backend(backend.get_id(name)))
538538
else:
539539
backend.set_unsafe(name)
540540
return
541541

542+
def get_backend():
543+
"""
544+
Return the name of the backend
545+
"""
546+
return backend.name()
547+
542548
def get_backend_id(A):
543549
"""
544550
Get backend name of an array

0 commit comments

Comments
 (0)