diff --git a/backends/vulkan/runtime/graph/ops/glsl/unary/unary_op.glslh b/backends/vulkan/runtime/graph/ops/glsl/unary/unary_op.glslh index c657ae81c2b..ac9a776b86b 100644 --- a/backends/vulkan/runtime/graph/ops/glsl/unary/unary_op.glslh +++ b/backends/vulkan/runtime/graph/ops/glsl/unary/unary_op.glslh @@ -101,16 +101,8 @@ vec4 hardsigmoid(vec4 tex) { hardsigmoid(tex.w)); } -float leaky_relu(float x, float negative_slope) { - return x * (float(x > 0.0) + negative_slope * float(x <= 0.0)); -} - vec4 leaky_relu(vec4 tex, float negative_slope) { - return vec4( - leaky_relu(tex.x, negative_slope), - leaky_relu(tex.y, negative_slope), - leaky_relu(tex.z, negative_slope), - leaky_relu(tex.w, negative_slope)); + return mix(tex * negative_slope, tex, greaterThan(tex, vec4(0))); } #endif