euclideanDistanceGPU function
GPUTensor<Scalar>
euclideanDistanceGPU(
- GPUTensor<
Vector> a, - GPUTensor<
Vector> b, - CommandBuffer tape
Implementation
GPUTensor<Scalar> euclideanDistanceGPU(GPUTensor<Vector> a, GPUTensor<Vector> b, CommandBuffer tape) {
// sqrt( sum( (a - b)^2 ) )
GPUTensor<Vector> diff = subtractGPU<Vector>(a, b, tape);
GPUTensor<Vector> squaredDiff = powGPU<Vector>(diff, 2.0, tape);
GPUTensor<Scalar> sumOfSquares = sumGPU(squaredDiff, tape);
return sqrtGPU<Scalar>(sumOfSquares, tape);
}