reshape3DToMatrixGPU function

GPUTensor<Matrix> reshape3DToMatrixGPU(
  1. GPUTensor<Tensor3D> t,
  2. int rows,
  3. int cols,
  4. CommandBuffer tape,
)

Implementation

GPUTensor<Matrix> reshape3DToMatrixGPU(GPUTensor<Tensor3D> t, int rows, int cols, CommandBuffer tape) {
  GPUTensor<Matrix> out = GPUTensor<Matrix>.empty(<int>[rows, cols]);

  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: 'reshape3DToMatrixGPU',
    cost: 0,
  );

  return out;
}