omega-bridge
Omega-first language interoperability: checked conversion backends and native language bindings
Brought by drakestapleton
omega-bridge / pytorch / kernels / relu.om
| 1 | note relu: o = x where x is not below 0.0, else 0.0 (aten.relu); NaN is kept, as aten.relu keeps it. |
| 2 | note The caller supplies the const line L (the element count) before this text. |
| 3 | fn relu x view f32 L o edit f32 L to void |
| 4 | for i ulong L |
| 5 | v = get x i |
| 6 | if lt v 0.0f32 |
| 7 | put o i 0.0f32 |
| 8 | else |
| 9 | put o i v |
| 10 | end |
| 11 | end |
| 12 | end |