Skip to main content

elementwise_wgsl

Function elementwise_wgsl 

Source
pub fn elementwise_wgsl(op: &str) -> String
Expand description

Generate WGSL source for an element-wise unary operation.

The shader reads n elements from input, applies the operation, and writes the results to output. Both buffers have arrayLength elements.

§Arguments

  • op — one of: "relu", "sigmoid", "tanh", "exp", "log", "sqrt", "abs", "neg". Unknown ops are treated as identity.