Click here to Skip to main content
15,878,316 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I'm trying to run a code that uses nearest neighbor module. It uses an attribute named Knn_batch in this module. The code gives me this error:

AttributeError: module 'nearest_neighbors' has no attribute 'knn_batch'


the code :
def knn_search(support_pts, query_pts, k):
    """
    :param support_pts: points you have, B*N1*3
    :param query_pts: points you want to know the neighbour index, B*N2*3
    :param k: Number of neighbours in knn search
    :return: neighbor_idx: neighboring points indexes, B*N2*k
    """

    neighbor_idx = nearest_neighbors.knn_batch(support_pts, query_pts, k, omp=True)
    return neighbor_idx.astype(np.int32)


What I have tried:

I need to build nearest neighbors on windows to have this attribute
Posted
Updated 15-Oct-21 22:43pm

1 solution

This is the same question you asked yesterday at How do I fix this error?[^]. And the answer remains the same. You need to check the nearest_neighbors module or class, and find out why this attribute is not present.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900