MCPcopy
hub / github.com/apache/tvm / hasTensorInCache

Function hasTensorInCache

web/src/artifact_cache.ts:860–878  ·  view source on GitHub ↗
(
  tensorCacheUrl: string,
  cacheScopeOrOptions: string | TensorCacheAccessOptions = "tvmjs",
  cacheType = "cache",
)

Source from the content-addressed store, hash-verified

858 cacheType?: string,
859): Promise<boolean>;
860export async function hasTensorInCache(
861 tensorCacheUrl: string,
862 cacheScopeOrOptions: string | TensorCacheAccessOptions = "tvmjs",
863 cacheType = "cache",
864): Promise<boolean> {
865 const options = normalizeCacheAccessOptions(cacheScopeOrOptions, cacheType);
866 const cacheScope = options.cacheScope ?? "tvmjs";
867 const artifactCache = createArtifactCache(cacheScope, options);
868 const jsonUrl = new URL("tensor-cache.json", tensorCacheUrl).href;
869 const hasJsonUrlInCache = await artifactCache.hasAllKeys([jsonUrl]);
870 if (!hasJsonUrlInCache) {
871 return false;
872 }
873 const list = (await artifactCache.fetchWithCache(
874 jsonUrl,
875 "json",
876 ))["records"] as Array<TensorShardEntry>;
877 return await artifactCache.hasAllKeys(list.map(key => new URL(key.dataPath, tensorCacheUrl).href));
878}
879
880
881/**

Callers

nothing calls this directly

Calls 4

createArtifactCacheFunction · 0.85
hasAllKeysMethod · 0.65
fetchWithCacheMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…