projector: fix the KNN algorithm (#4690)
projector: fix the KNN algorithm (#4690)

Previously, we were using weblas for GPGPU which had to be replaced for
its lack of security patch. In doing so, we replaced the matmul with
TF.js but we did an incorrect cosine distance computation because we did
not transpose the matrix but instead reshaped it.

With this change, we now calculate the cosine distance better and even
more efficiently using the batch/slice to move less data away from GPU.

tensorflow/tensorboard,tensorflow/tensorboard,tensorflow/tensorboard,tensorflow/tensorboard,tensorflow/tensorboard,tensorflow/tensorboard,tensorflow/tensorboard