gpuSigmoid (Function)
Signature: gpuSigmoid(x: GpuBuffer<float32>) -> Result<GpuBuffer<float32>, Error>
Description: The logistic function 1 / (1 + exp(-x)) of every element [LLM-SIGMOID], as a library kernel on the target's native binary32 exp. Device results agree with the host's within exp's ulps, not bit for bit.
Parameters
- x (
GpuBuffer<float32>): The float32 buffer
Returns: Result<GpuBuffer<float32>, Error>
Example
fn showSigmoid(gates) = match gpuSigmoid(gates) {
Success { value } => print(gpuLength(value))
Error { message } => print(message)
}
showSigmoid gates =
match gpuSigmoid gates
Success value => print (gpuLength value)
Error message => print message