Update distance computation for k-nearest neighbours to be more efficient, by computing the norms separately.
Update distance computation for k-nearest neighbours to be more efficient, by computing the norms separately.

PiperOrigin-RevId: 176585527

vthorsteinsson/tensor2tensor,tensorflow/tensor2tensor,rsepassi/tensor2tensor,tensorflow/tensor2tensor,rsepassi/tensor2tensor,vthorsteinsson/tensor2tensor,tensorflow/tensor2tensor,tensorflow/tensor2tensor,vthorsteinsson/tensor2tensor,rsepassi/tensor2tensor,tensorflow/tensor2tensor,rsepassi/tensor2tensor,vthorsteinsson/tensor2tensor