reshapeVectorToMatrixGPU function
///////////////////////////////// Data management (0-99) /// /////////////////////////////////
Implementation
GPUTensor<Matrix> reshapeVectorToMatrixGPU(
GPUTensor<Vector> v, int numRows, int numCols, CommandBuffer tape,
{GPUTensor<Matrix>? outTensor}) {
GPUTensor<Matrix> out =
outTensor ?? GPUTensor<Matrix>.empty(<int>[numRows, numCols]);
tape.putInt(OP_COPY);
tape.putString(v.id);
tape.putString(out.id);
out.creator = GPUNode(
[v],
(CommandBuffer bTape) {
bTape.putInt(OP_ADD_INTO);
bTape.putString(out.gradId);
bTape.putString(v.gradId);
},
opName: 'reshapeGPU',
extraParams: {'numRows': numRows, 'numCols': numCols},
cost: 0,
);
return out;
}