Temporary bfloat16 expression. This class represents a bfloat16 expression which just stores a single-precision value internally.
| 195 | /// This class represents a bfloat16 expression which just stores a |
| 196 | /// single-precision value internally. |
| 197 | struct expr { |
| 198 | /// Conversion constructor. |
| 199 | /// \param f single-precision value to convert |
| 200 | MEGDNN_HOST MEGDNN_DEVICE explicit HALF_CONSTEXPR expr(float f) |
| 201 | : value_(f) {} |
| 202 | |
| 203 | /// Conversion to single-precision. |
| 204 | /// \return single precision value representing expression value |
| 205 | MEGDNN_HOST MEGDNN_DEVICE HALF_CONSTEXPR operator float() const { |
| 206 | return value_; |
| 207 | } |
| 208 | |
| 209 | private: |
| 210 | /// Internal expression value stored in single-precision. |
| 211 | float value_; |
| 212 | }; |
| 213 | |
| 214 | /// SFINAE helper for generic bfloat16 functions. |
| 215 | /// This class template has to be specialized for each valid combination of |