divide3DGPU function

Implementation

GPUTensor<Tensor3D> divide3DGPU(GPUTensor<Tensor3D> a, GPUTensor<Tensor3D> b, CommandBuffer tape) {
  int depth = a.shape[0];
  int height = a.shape[1];
  int width = a.shape[2];
  List<int> shape = <int>[depth, height, width];
  GPUTensor<Tensor3D> out = GPUTensor<Tensor3D>.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: 'divide3DGPU',
    cost: depth * height * width,
  );

  return out;
}