numpy.sum fails on seemingly simple example

0 views
Skip to first unread message

Nicolas Granger

unread,
Aug 9, 2016, 11:02:17 AM8/9/16
to Numba Public Discussion - Public
Hi,
I would like some help on an error that appears when calling a jitted function from a jitted function.

I am using the git version of numba and llvmlite (at most 48H old).

The problematic part looks like this:

@nb.jit(nopython=True) # <--- Works ok if I remove this
def compute(img, n_bins=9, cell_size=(8, 8), block_size=(3, 3)):
   
# ... some work
    clustered
= cluster(int_binned, cell_size)
    square_norms
= np.sum(clustered * clustered, axis=2)

where clustered is a jitted function that seems to works properly.

I have put the complete code on this gist, the error appears in hog.py:139, test_hog.py is
here to demonstrate the role of individual functions (including cluster).

This is not a very minimal example because I don't know how to check the final steps without a plot.
I can can extract a smaller version that just triggers an error if you wish.

Best regard,
Nicolas

Matthieu Dartiailh

unread,
Aug 9, 2016, 11:07:38 AM8/9/16
to numba...@continuum.io

Looking at the documentation sum is only supported in the simple form (without optional arguments). So you won't be able to use the axis argument. You should however be able to re-write the function yourself.

Best

Matthieu

--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users...@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/74b1c63c-b3e8-46d3-9d8d-9c878f65a361%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Reply all
Reply to author
Forward
0 new messages