deepof.model_utils.get_k_nearest_neighbors

deepof.model_utils.get_k_nearest_neighbors(tensor, k, index)

Retrieve indices of the k nearest neighbors in tensor to the vector with the specified index.

Parameters:
  • tensor (tf.Tensor) – tensor to compute the k nearest neighbors for

  • k (int) – number of nearest neighbors to retrieve

  • index (int) – index of the vector to compute the k nearest neighbors for

Returns:

indices of the k nearest neighbors

Return type:

tf.Tensor