def result(inp): dtype = inp.dtype ctx_name = _name_for_ctx(inp.context) key = (dtype, ctx_name) f = result.cache.get(key, None) if f is None: guard_in = GpuArrayType(str(dtype), (False, ), context_name=ctx_name)() mode = get_mode("FAST_RUN").including("gpuarray") f = aesara.function([guard_in], op(guard_in), mode=mode, profile=False) result.cache[key] = f return f(inp)
def write_array(f): pickle.dump(_name_for_ctx(obj.context), f, 2) np.lib.format.write_array(f, np.asarray(obj))