[python-arrayfire] 06/11: FEAT: Adding additional helper library functions
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu May 26 17:37:12 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/master
in repository python-arrayfire.
commit 87fdd110685cd639a036170ff8c0d1c3f07a78d8
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date: Mon May 16 00:15:29 2016 -0400
FEAT: Adding additional helper library functions
- get_backend: returns name of the backend
---
arrayfire/library.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/arrayfire/library.py b/arrayfire/library.py
index 432ebb8..822d75a 100644
--- a/arrayfire/library.py
+++ b/arrayfire/library.py
@@ -531,7 +531,7 @@ def set_backend(name, unsafe=False):
If False, does not switch backend if current backend is not unified backend.
"""
if (backend.is_unified() == False and unsafe == False):
- raise RuntimeError("Can not change backend after loading %s" % name)
+ raise RuntimeError("Can not change backend to %s after loading %s" % (name, backend.name()))
if (backend.is_unified()):
safe_call(backend.get().af_set_backend(backend.get_id(name)))
@@ -539,6 +539,12 @@ def set_backend(name, unsafe=False):
backend.set_unsafe(name)
return
+def get_backend():
+ """
+ Return the name of the backend
+ """
+ return backend.name()
+
def get_backend_id(A):
"""
Get backend name of an array
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-arrayfire.git
More information about the debian-science-commits
mailing list