vectorTanhGPU function
Implementation
GPUTensor<Vector> vectorTanhGPU(GPUTensor<Vector> v, CommandBuffer tape) {
int N = v.shape[0];
GPUTensor<Vector> out = GPUTensor<Vector>(List<double>.filled(N, 0.0));
tape.putInt(OP_TANH);
tape.putString(v.id);
tape.putString(out.id);
out.creator = GPUNode(
[v],
(CommandBuffer bTape) {
bTape.putInt(OP_TANH_BACKWARD);
bTape.putString(out.id);
bTape.putString(out.id);
bTape.putString(v.id);
},
opName: 'tanh_vectorGPU',
cost: N,
);
return out;
}