We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
is_floating_point
1 parent bfa4699 commit 77fc946Copy full SHA for 77fc946
src/onnx_ir/_enums.py
@@ -142,6 +142,20 @@ def short_name(self) -> str:
142
raise TypeError(f"Short name not available for ONNX data type: {self}")
143
return _DATA_TYPE_TO_SHORT_NAME[self]
144
145
+ def is_floating_point(self) -> bool:
146
+ """Returns True if the data type is a floating point type."""
147
+ return self in {
148
+ DataType.FLOAT,
149
+ DataType.FLOAT16,
150
+ DataType.DOUBLE,
151
+ DataType.BFLOAT16,
152
+ DataType.FLOAT8E4M3FN,
153
+ DataType.FLOAT8E4M3FNUZ,
154
+ DataType.FLOAT8E5M2,
155
+ DataType.FLOAT8E5M2FNUZ,
156
+ DataType.FLOAT4E2M1,
157
+ }
158
+
159
def __repr__(self) -> str:
160
return self.name
161
0 commit comments