( cacheUrl: string, cacheScopeOrOptions: string | TensorCacheAccessOptions = "tvmjs", cacheType = "cache", )
| 895 | cacheType?: string, |
| 896 | ): Promise<void>; |
| 897 | export async function deleteTensorCache( |
| 898 | cacheUrl: string, |
| 899 | cacheScopeOrOptions: string | TensorCacheAccessOptions = "tvmjs", |
| 900 | cacheType = "cache", |
| 901 | ): Promise<void> { |
| 902 | const options = normalizeCacheAccessOptions(cacheScopeOrOptions, cacheType); |
| 903 | const cacheScope = options.cacheScope ?? "tvmjs"; |
| 904 | const artifactCache = createArtifactCache(cacheScope, options); |
| 905 | if (artifactCache instanceof ArtifactCrossOriginStorageCache) { |
| 906 | // Cross-origin storage extension does not currently support programmatic deletion. |
| 907 | return; |
| 908 | } |
| 909 | const jsonUrl = new URL("tensor-cache.json", cacheUrl).href; |
| 910 | const list = await artifactCache.fetchWithCache(jsonUrl, "json"); |
| 911 | const arrayentry = list["records"] as Array<TensorShardEntry>; |
| 912 | const processShard = async (i: number) => { |
| 913 | const dataUrl = new URL(arrayentry[i].dataPath, cacheUrl).href; |
| 914 | await artifactCache.deleteInCache(dataUrl); |
| 915 | } |
| 916 | await Promise.all(arrayentry.map((_, index) => processShard(index))); |
| 917 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…