[python-arrayfire] 05/11: Ensure arrayfire is called in infix operations with numpy

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 5ddeb97c27a72aa77a6979d3fd8c78b777dbfb77
Author: Filipe Maia <filipe.c.maia at gmail.com>
Date:   Thu Mar 24 19:29:31 2016 +0100

    Ensure arrayfire is called in infix operations with numpy
---
 arrayfire/array.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arrayfire/array.py b/arrayfire/array.py
index 712c7ea..327fd6b 100644
--- a/arrayfire/array.py
+++ b/arrayfire/array.py
@@ -373,6 +373,12 @@ class Array(BaseArray):
 
     """
 
+    # Numpy checks this attribute to know which class handles binary builtin operations, such as __add__.
+    # Setting to such a high value should make sure that arrayfire has priority over
+    # other classes, ensuring that e.g. numpy.float32(1)*arrayfire.randu(3) is handled by
+    # arrayfire's __radd__() instead of numpy's __add__()
+    __array_priority__ = 30
+
     def __init__(self, src=None, dims=(0,), dtype=None, is_device=False, offset=None, strides=None):
 
         super(Array, self).__init__()

-- 
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