divideVectorGPU function

GPUTensor<Vector> divideVectorGPU(
  1. GPUTensor<Vector> a,
  2. GPUTensor<Vector> b,
  3. CommandBuffer tape
)

Implementation

}GPUTensor<Vector> divideVectorGPU(GPUTensor<Vector> a, GPUTensor<Vector> b, CommandBuffer tape) {
  int length = a.shape[0];
  List<int> shape = <int>[length];
  GPUTensor<Vector> out = GPUTensor<Vector>.empty(shape);

  tape.putInt(OP_DIVIDE);
  tape.putString(a.id);
  tape.putString(b.id);
  tape.putString(out.id);

  out.creator = GPUNode(
    <GPUTensor>[a, b],
        (CommandBuffer bTape) {
      bTape.putInt(OP_DIVIDE_BACKWARD);
      bTape.putString(a.id);
      bTape.putString(b.id);
      bTape.putString('${out.id}_grad');
      bTape.putString('${a.id}_grad');
      bTape.putString('${b.id}_grad');
    },
    opName: 'divideVectorGPU',
    cost: length,
  );

  return out;
}