dotProductGPU function

GPUTensor<Scalar> dotProductGPU(
  1. GPUTensor<Vector> a,
  2. GPUTensor<Vector> b,
  3. CommandBuffer tape, {
  4. GPUTensor<Vector>? multipliedTensor,
  5. GPUTensor<Scalar>? outTensor,
})

Calculates the dot product between vector a and b. The operations are appended to tape for execution. The operations are appended to tape for execution.

Implementation

GPUTensor<Scalar> dotProductGPU(
    GPUTensor<Vector> a, GPUTensor<Vector> b, CommandBuffer tape,
    {GPUTensor<Vector>? multipliedTensor, GPUTensor<Scalar>? outTensor}) {
  GPUTensor<Vector> multiplied =
      multiplyGPU<Vector>(a, b, tape, outTensor: multipliedTensor);
  GPUTensor<Scalar> out = sumGPU(multiplied, tape, outTensor: outTensor);
  out.subMap["multiplied"] = multiplied;
  return out;
}