| 1004 | }; |
| 1005 | struct Heaviside { |
| 1006 | bfloat16 operator()(bfloat16 bx, bfloat16 h0) { |
| 1007 | float x = static_cast<float>(bx); |
| 1008 | if (std::isnan(x)) { |
| 1009 | return bx; |
| 1010 | } |
| 1011 | if (x < 0) { |
| 1012 | return bfloat16(0.0f); |
| 1013 | } |
| 1014 | if (x > 0) { |
| 1015 | return bfloat16(1.0f); |
| 1016 | } |
| 1017 | return h0; // x == 0 |
| 1018 | } |
| 1019 | }; |
| 1020 | struct Conjugate { |
| 1021 | bfloat16 operator()(bfloat16 a) { return a; } |