I am trying to make a class with a dictionary member that its value is class itself.
Code below is my try.
import numpy as np
import numba
from numba import jit, jitclass, types, typed
dict_type = numba.deferred_type()
node_spec = [
('key', numba.uint32),
('data', numba.uint32[:]),
('count', numba.uint32),
('children', dict_type)
]
@numba.experimental.jitclass(node_spec)
class Node:
def __init__(self, key, data=None):
self.key = key
self.data = data
self.count = 0
self.children = {}
node_instance = Node.class_type.instance_type
dict_type.define(numba.typeof(typed.Dict.empty(
key_type=numba.uint32,
value_type=node_instance
)))