|
11 | 11 | from numba.core.caching import CacheImpl, _CacheLocator |
12 | 12 |
|
13 | 13 | from pytensor import config |
14 | | -from pytensor.graph.basic import Apply |
15 | 14 | from pytensor.link.numba.compile import numba_funcify, numba_njit |
16 | 15 |
|
17 | 16 |
|
@@ -65,22 +64,6 @@ def from_function(cls, py_func, py_file): |
65 | 64 | CacheImpl._locator_classes.insert(0, NumbaPyTensorCacheLocator) |
66 | 65 |
|
67 | 66 |
|
68 | | -def cache_node_key(node: Apply, extra_key="") -> str: |
69 | | - op = node.op |
70 | | - return sha256( |
71 | | - str( |
72 | | - ( |
73 | | - # Op signature |
74 | | - (type(op), op._props_dict() if hasattr(op, "_props_dict") else ""), |
75 | | - # Node signature |
76 | | - tuple((type(inp_type := inp.type), inp_type) for inp in node.inputs), |
77 | | - # Extra key given by the caller |
78 | | - extra_key, |
79 | | - ), |
80 | | - ).encode() |
81 | | - ).hexdigest() |
82 | | - |
83 | | - |
84 | 67 | @singledispatch |
85 | 68 | def numba_funcify_default_op_cache_key( |
86 | 69 | op, node=None, **kwargs |
@@ -109,7 +92,7 @@ def decorator(dispatch_func): |
109 | 92 | # Create a wrapper for the non-cache dispatcher |
110 | 93 | @wraps(dispatch_func) |
111 | 94 | def dispatch_func_wrapper(*args, **kwargs): |
112 | | - func, key = dispatch_func(*args, **kwargs) |
| 95 | + func, _key = dispatch_func(*args, **kwargs) |
113 | 96 | # Discard the key for the non-cache version |
114 | 97 | return func |
115 | 98 |
|
@@ -172,7 +155,7 @@ def decorator(dispatch_func): |
172 | 155 | # Create a wrapper for the non-cache dispatcher |
173 | 156 | @wraps(dispatch_func) |
174 | 157 | def dispatch_func_wrapper(*args, **kwargs): |
175 | | - func, key = dispatch_func(*args, **kwargs) |
| 158 | + func, _key = dispatch_func(*args, **kwargs) |
176 | 159 | # Discard the key for the non-cache version |
177 | 160 | return func |
178 | 161 |
|
|
0 commit comments