From 5b68125c9cad912775d4b184b10ecad7aaa2e152 Mon Sep 17 00:00:00 2001
From: lucas_miranda <lucasmiranda42@gmail.com>
Date: Tue, 18 May 2021 19:40:48 +0200
Subject: [PATCH] Replaced for loop with vectorised mapping on ClusterOverlap
 regularization layer

---
 deepof/model_utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/deepof/model_utils.py b/deepof/model_utils.py
index 37356da8..dbe1d3b4 100644
--- a/deepof/model_utils.py
+++ b/deepof/model_utils.py
@@ -39,7 +39,7 @@ def compute_shannon_entropy(tensor):
 @tf.function
 def get_k_nearest_neighbors(tensor, k, index):
     """Retrieve indices of the k nearest neighbors in tensor to the vector with the specified index"""
-    query = tf.slice(tensor, index, 1)
+    query = tensor[index]
     distances = tf.norm(tensor - query, axis=1)
     max_distance = tf.sort(distances)[k]
     neighbourhood_mask = distances < max_distance
-- 
GitLab