Skip to content

Commit 2b144d6

Browse files
committed
fix __cache of fft in RC methods
1 parent 0a917ec commit 2b144d6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/aspire/classification/averager2d.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,10 @@ def _phase_cross_correlation(self, img0, img1):
479479

480480
# Cache img0 transform, this saves n_classes*(n_nbor-1) transforms
481481
# Note we use the `id` because ndarray are unhashable
482-
src_f = self.__cache.setdefault(id(img0), fft.fft2(img0))
482+
key = id(img0)
483+
if key not in self.__cache:
484+
self.__cache[key] = fft.fft2(img0)
485+
src_f = self.__cache[key]
483486

484487
target_f = fft.fft2(img1)
485488

0 commit comments

Comments
 (0)