You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have included a self contained code sample to reproduce the problem.
i.e. it's possible to run as 'python bug.py'.
I'm wondering if code like this could potentially be handled directly by Numba. The following fails at present as it can't unify agg in the agg.shape call. If the following sequence of passes were run:
PartialTypeInference (aggs_and_cols[0] inferred as 3d)
RewriteSemanticConstants (aggs_and_cols[0].ndim baked into IR as const(3)? maybe needs some work on the pass)
DeadBranchPrune (Remove branching as 3 == 3 is always True)
it might allow elimination of the control flow and permit compilation.
fromnumbaimportnjitimportnumpyasnp@njitdeffoo(*aggs_and_cols):
i=0agg=aggs_and_cols[0] # This agg is 3Difaggs_and_cols[0].ndim==3: # This type could be inferred, semantic rewritten and branch pruned.cat_index=aggs_and_cols[1][i]
agg=agg[:, :, cat_index] # This agg is 2Dxmax=agg.shape[1] -1# What's this agg? 2D or 3D?args= (np.zeros((3, 4, 5)), (0, 0))
foo(*args)
The text was updated successfully, but these errors were encountered:
Reporting a bug
visible in the change log (https://github.com/numba/numba/blob/main/CHANGE_LOG).
i.e. it's possible to run as 'python bug.py'.
I'm wondering if code like this could potentially be handled directly by Numba. The following fails at present as it can't unify
agg
in theagg.shape
call. If the following sequence of passes were run:aggs_and_cols[0]
inferred as 3d)aggs_and_cols[0].ndim
baked into IR asconst(3)
? maybe needs some work on the pass)3 == 3
is always True)it might allow elimination of the control flow and permit compilation.
The text was updated successfully, but these errors were encountered: