fast_knn_gpu
fast_knn_gpu copied to clipboard
how do you calculate knn(gpu)?
why the value pred is the knn prediction in your code? normalized_keys = l2_normalize(x_keys, dim=1) normalized_query = l2_normalize(x_queries, dim=1) query_result = T.dot(normalized_keys, normalized_query.T) pred = T.argmax(query_result, axis=0)
Declare the knn function
knn = theano.function(inputs=[x_keys, x_queries], outputs=pred)
thanks