MCPcopy Index your code
hub / github.com/DustinBrett/daedalOS / fetchNDArrayCache

Method fetchNDArrayCache

public/System/tvm/tvmjs.bundle.js:2398–2423  ·  view source on GitHub ↗

* Fetch NDArray cache from url. * * @param ndarrayCacheUrl The cache url. * @param device The device to be fetched to. * @returns The meta data

(ndarrayCacheUrl, device)

Source from the content-addressed store, hash-verified

2396 * @returns The meta data
2397 */
2398 fetchNDArrayCache(ndarrayCacheUrl, device) {
2399 return __awaiter(this, void 0, void 0, function* () {
2400 const jsonUrl = new URL("ndarray-cache.json", ndarrayCacheUrl).href;
2401 const request = new Request(jsonUrl);
2402 const cache = yield caches.open("tvmjs");
2403 let result = yield cache.match(request);
2404 if (result === undefined) {
2405 yield cache.add(request);
2406 result = yield cache.match(request);
2407 }
2408 if (result === undefined) {
2409 this.env.logger("Error: Cannot cache " + jsonUrl + ", reloading will be slow");
2410 try {
2411 result = yield fetch(request);
2412 } catch (err) {
2413 this.env.logger("Cannot fetch " + jsonUrl);
2414 }
2415 }
2416 let list;
2417 if (result instanceof Response) {
2418 list = yield result.json();
2419 }
2420 yield this.fetchNDArrayCacheInternal(ndarrayCacheUrl, list["records"], device);
2421 this.cacheMetadata = Object.assign(Object.assign({}, this.cacheMetadata), list["metadata"]);
2422 });
2423 }
2424 /**
2425 * Fetch list of NDArray into the NDArrayCache.
2426 *

Callers 2

asyncInitServerMethod · 0.80
#asyncInitTVMMethod · 0.80

Calls 6

fetchFunction · 0.85
assignMethod · 0.80
openMethod · 0.45
matchMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected