( tensorCacheUrl: string, cacheScopeOrOptions: string | TensorCacheAccessOptions = "tvmjs", cacheType = "cache", )
| 858 | cacheType?: string, |
| 859 | ): Promise<boolean>; |
| 860 | export 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 | /** |
nothing calls this directly
no test coverage detected
searching dependent graphs…