DiegoCao commented on code in PR #16525:
URL: https://github.com/apache/tvm/pull/16525#discussion_r1488496964
##########
web/src/runtime.ts:
##########
@@ -1477,6 +1489,41 @@ export class Instance implements Disposable {
this.cacheMetadata = { ...this.cacheMetadata, ...(list["metadata"] as
Record<string, any>) };
}
+ /**
+ * Delete NDArray from cache url.
+ *
+ * @param ndarrayCacheUrl
+ * @param device
+ * @param cacheScope
+ */
+ async deleteNDArrayCache(
+ ndarrayCacheUrl: string,
+ device: DLDevice,
+ cacheScope = "tvmjs"
+ ): Promise<any>{
+ const artifactCache = new ArtifactCache(cacheScope);
+ const jsonUrl = new URL("ndarray-cache.json", ndarrayCacheUrl).href;
+ const result = await artifactCache.fetchWithCache(jsonUrl);
+ let list;
+ if (result instanceof Response){
+ list = await result.json();
+ }
+ const arrayentry = list["records"] as Array<NDArrayShardEntry>;
+ for (let i = 0; i < arrayentry.length; ++i){
+ const dataUrl = new URL(arrayentry[i].dataPath, ndarrayCacheUrl).href;
+ try {
+ const result = await(await artifactCache.deleteInCache(dataUrl));
+ if (result === false){
+ return false;
+ }
Review Comment:
I also prefer the latter one. Will change the function to void
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]