Skip to content

Ensure arrayfire is called in infix operations with numpy #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 24, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions arrayfire/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__()
Expand Down