小编Rob*_*Ren的帖子

numba\jit 不允许在 nopython 模式下使用 np argsort

收到此错误消息:

Failed at nopython (nopython frontend)

[1m[1m[1mInvalid usage of Function(<function argsort at 0x0000000002A67840>) with parameters (array(float64, 2d, C), axis=int64)

 * parameterized

In definition 0:
Run Code Online (Sandbox Code Playgroud)


使用此代码时

def rankbids(bids, shifts, groupPeriod, period):
    rowsSize = bids.shape[0];

    finaltable = np.zeros((rowsSize, groupPeriod), dtype=np.float64)
    for i in range(0, period):
        #for 0 to 99
        #CONSTANT 4 UPDATE WHEN NEEDED


        for worker in range(rowsSize):
            shiftNum = int(shifts[worker,i]);

            finaltable[worker, (shiftNum+i*10)] = bids[worker,i];

            if shiftNum == 1:
                finaltable[worker, (shiftNum+i*10)] = bids[worker,i];
                finaltable[worker, (shiftNum+1+i*10)] = bids[worker,i];
                finaltable[worker, (shiftNum+2+i*10)] = bids[worker,i];
            elif …
Run Code Online (Sandbox Code Playgroud)

jit numpy python-3.x numba numpy-ndarray

0
推荐指数
1
解决办法
650
查看次数

标签 统计

jit ×1

numba ×1

numpy ×1

numpy-ndarray ×1

python-3.x ×1