flatten3DToMatrixGPU function
Implementation
GPUTensor<Matrix> flatten3DToMatrixGPU(GPUTensor<Tensor3D> t, CommandBuffer tape) {
int c = t.shape[0];
int h = t.shape[1];
int w = t.shape[2];
int flatSize = c * h * w;
GPUTensor<Matrix> out = GPUTensor<Matrix>.empty(<int>[1, flatSize]);
tape.putInt(OP_COPY);
tape.putString(t.id);
tape.putString(out.id);
out.creator = GPUNode(
<GPUTensor>[t],
(CommandBuffer bTape) {
bTape.putInt(OP_ADD_INTO);
bTape.putString('${out.id}_grad');
bTape.putString('${t.id}_grad');
},
opName: 'flatten3DToMatrixGPU',
cost: 0,
);
return out;
}