I have some class:
from numba import jitclass, int32, float32, types
from numba.typed import List
_spec = [
('Y_rf', types.List(float32[:, :])),
...
]
@jitclass(_spec)
class DensityRatioEstimation:
def __init__(self, sigma):
self.sigma = sigma
self.Y_rf = [np.array([[0.]], dtype=float32)]
But I can't make it work. It always broke with different errors. For now error is:
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Internal error at <numba.typeinfer.CallConstraint object at 0x00000277CBBBF550>.
Failed in nopython mode pipeline (step: nopython mode backend)
File "src\models\DDRE.py", line 26:
def __init__(self, sigma):
<source elided>
self.sigma = sigma
self.Y_rf = [np.array([[0.]], dtype=float32)]
^
[1] During: lowering "(self).Y_rf = $0.11" at D:\anomaly-detection\src\models\DDRE.py (26)
[2] During: resolving callee type: jitclass.DensityRatioEstimation#277c8a6cdd8<sigma:float32,Y_rf:list(array(float32, 2d, A)),Y_te:list(array(float32, 2d, A)),k:int32,alphas:array(float32, 1d, A),b:array(float32, 1d, A)>
[3] During: typing of call at <string> (3)
Enable logging at debug level for details.
File "<string>", line 3:
<source missing, REPL/exec in use?>
I also tried to use List.empty_list(float32[:, :]) from numba.types.List instead [np.array([[0.]], dtype=float32)]. But it is also not working. How to fix that?