Skip to content

Commit

Permalink
testing knn
Browse files Browse the repository at this point in the history
  • Loading branch information
adarshyoga committed Apr 20, 2024
1 parent bb7f537 commit fe9038c
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ sycl::event knn_impl(sycl::queue q,

// here k has to be 5 in order to match with numpy no. of
// neighbors
struct neighbors<FpTy> queue_neighbors[5];
struct neighbors<FpTy> queue_neighbors[5] = {0.0,0};

// count distances
for (size_t j = 0; j < k; ++j) {
Expand All @@ -48,7 +48,7 @@ sycl::event knn_impl(sycl::queue q,
FpTy dist = sqrt(distance);

queue_neighbors[j].dist = dist;
queue_neighbors[j].label = d_train_labels[j];
//queue_neighbors[j].label = d_train_labels[j];
}

// sort queue
Expand All @@ -64,7 +64,7 @@ sycl::event knn_impl(sycl::queue q,
index--;

queue_neighbors[index].dist = new_distance;
queue_neighbors[index].label = new_neighbor_label;
//queue_neighbors[index].label = new_neighbor_label;
}
}

Expand All @@ -80,7 +80,7 @@ sycl::event knn_impl(sycl::queue q,

if (dist < queue_neighbors[k - 1].dist) {
queue_neighbors[k - 1].dist = dist;
queue_neighbors[k - 1].label = d_train_labels[j];
//queue_neighbors[k - 1].label = d_train_labels[j];

// push queue
FpTy new_distance = queue_neighbors[k - 1].dist;
Expand All @@ -94,7 +94,7 @@ sycl::event knn_impl(sycl::queue q,
index--;

queue_neighbors[index].dist = new_distance;
queue_neighbors[index].label = new_neighbor_label;
//queue_neighbors[index].label = new_neighbor_label;
}
}
}
Expand Down

0 comments on commit fe9038c

Please sign in to comment.