Created
September 19, 2019 17:41
-
-
Save sklam/945c3304c4b132127df377fa317f5ae5 to your computer and use it in GitHub Desktop.
JITClass Dictionary Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numba import jitclass | |
from numba import types | |
from numba.typed import Dict | |
@jitclass([('d', types.DictType(types.intp, types.float64))]) | |
class DictWrapper(object): | |
def __init__(self): | |
d = Dict() | |
d[1] = 1.2 | |
self.d = d | |
dw = DictWrapper() | |
print(dw.d) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does np,asarray() work in jit region? All examples I have seen use np.arange(). How can I construct dictionary within njit?