add3DGPU function
Implementation
GPUTensor<Tensor3D> add3DGPU(GPUTensor<Tensor3D> a, GPUTensor<Tensor3D> b, CommandBuffer tape) {
int depth = a.shape[0];
int height = a.shape[1];
int width = a.shape[2];
GPUTensor<Tensor3D> out = GPUTensor<Tensor3D>.empty(<int>[depth, height, width]);
tape.putInt(OP_ADD);
tape.putString(a.id);
tape.putString(b.id);
tape.putString(out.id);
out.creator = GPUNode(
[a, b],
(CommandBuffer bTape) {
bTape.putInt(OP_ADD_INTO);
bTape.putString('${out.id}_grad');
bTape.putString('${a.id}_grad');
bTape.putInt(OP_ADD_INTO);
bTape.putString('${out.id}_grad');
bTape.putString('${b.id}_grad');
},
opName: 'add_3dGPU',
cost: depth * height * width,
);
return out;
}