sigmoidMatrixGPU function

GPUTensor<Matrix> sigmoidMatrixGPU(
  1. GPUTensor<Matrix> m,
  2. CommandBuffer tape
)

Implementation

GPUTensor<Matrix> sigmoidMatrixGPU(GPUTensor<Matrix> m, CommandBuffer tape) {
  int numRows = m.shape[0];
  int numCols = m.shape[1];

  GPUTensor<Matrix> out = GPUTensor<Matrix>.empty(<int>[numRows, numCols]);

  tape.putInt(OP_SIGMOID);
  tape.putString(m.id);
  tape.putString(out.id);

  out.creator = GPUNode(
    [m],
        (CommandBuffer bTape) {
      bTape.putInt(OP_SIGMOID_BACKWARD);
      bTape.putString(out.id);
      bTape.putString('${out.id}_grad');
      bTape.putString('${m.id}_grad');
    },
    opName: 'sigmoid_matrixGPU',
    cost: numRows * numCols,
  );

  return out;
}