volk
volk copied to clipboard
clamp function call
I quite often find myself wanting to clamp a vector to specific values, i.e:
for all x:
if x > max_val
x = max_val
else if x < min_val
x = min_val
end
end
Would this be worthwhile to implement?
Generally, I'd say all kernels are a welcome addition. There are some type conversion kernels that already implement this function for specific values. You're welcome to open a PR for such a kernel.
I second this. Some function like this on f32 would be a very welcome addition.
See PR that implements this.