sigmoidScalarGPU<T> function

GPUTensor<T> sigmoidScalarGPU<T>(
  1. GPUTensor<T> s,
  2. CommandBuffer tape
)

Implementation

GPUTensor<T> sigmoidScalarGPU<T>(GPUTensor<T> s, CommandBuffer tape) {
  dynamic dummy = T == Scalar ? 0.0 : (T == Vector ? <double>[] : <List<double>>[]);
  GPUTensor<T> out = GPUTensor<T>(dummy);

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

  out.creator = GPUNode(
    [s],
        (CommandBuffer bTape) {
      bTape.putInt(OP_SIGMOID_BACKWARD);
      bTape.putString(out.id);
      bTape.putString('${out.id}_grad');
      bTape.putString('${s.id}_grad');
    },
    opName: 'sigmoidScalarGPU',
    cost: 1,
  );

  return out;
}