Skip to content

V2: Overriding behavior in Numba #1639

Answered by agoose77
Saransh-cpp asked this question in Q&A
Discussion options

You must be logged in to vote

Whilst we're in the v1→v2 transition, we haven't registered the NumPy or Numba dispatch mechanisms, so calling np.func(array) or jitting with Numba doesn't work out of the box. You can register the Numba machinery using the same code from v1 in ak._connect._numba.__init__:

@numba.extending.typeof_impl.register(ak.highlevel.Array)
def typeof_Array(obj, c):
    return obj.numba_type

@numba.extending.typeof_impl.register(ak.highlevel.Record)
def typeof_Record(obj, c):
    return obj.numba_type

@numba.extending.typeof_impl.register(ak.highlevel.ArrayBuilder)
def typeof_ArrayBuilder(obj, c):
    return obj.numba_type

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Saransh-cpp
Comment options

Answer selected by Saransh-cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants