reshapeVectorToMatrixGPU function

GPUTensor<Matrix> reshapeVectorToMatrixGPU(
  1. GPUTensor<Vector> v,
  2. int numRows,
  3. int numCols,
  4. CommandBuffer tape,
)

///////////////////////////////// Data management (0-99) /// /////////////////////////////////

Implementation

GPUTensor<Matrix> reshapeVectorToMatrixGPU(GPUTensor<Vector> v, int numRows, int numCols, CommandBuffer tape) {
  GPUTensor<Matrix> out = 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.id}_grad');
      bTape.putString('${v.id}_grad');
    },
    opName: 'reshapeGPU',
    extraParams: {'numRows': numRows, 'numCols': numCols},
    cost: 0,
  );

  return out;
}