amazon-science / patchcore-inspection

Apache License 2.0
691 stars 142 forks source link

Why is detach True by default? #70

Open AlessandroPolidori opened 1 year ago

AlessandroPolidori commented 1 year ago

https://github.com/amazon-science/patchcore-inspection/blob/fcaa92f124fb1ad74a7acf56726decd4b27cbcad/src/patchcore/patchcore.py#L91

Hi, i was using the PatchCore model to extract features and i was wandering why it took so much time. My mistake was to keep the default value of detach (True), which implies that a list of detached tensors is built before returning. This is so much time consuming. I was wondering why this is the default behavior of _embed (you probabily need that list in a following step) and if maybe there is an optimized alternative way to obtain that list.