Skip to content

Instantly share code, notes, and snippets.

@sklam
Created September 19, 2019 17:41
Show Gist options
  • Save sklam/945c3304c4b132127df377fa317f5ae5 to your computer and use it in GitHub Desktop.
Save sklam/945c3304c4b132127df377fa317f5ae5 to your computer and use it in GitHub Desktop.
JITClass Dictionary Example
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)
@samaid
Copy link

samaid commented Oct 18, 2019

Does np,asarray() work in jit region? All examples I have seen use np.arange(). How can I construct dictionary within njit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment