You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds comprehensive support for the FLOAT8E8M0 data type that was
added to ONNX in onnx/onnx#7030.
## Changes Made
- **Added FLOAT8E8M0 enum value**: Set to 24 (next available value after
FLOAT4E2M1=23)
- **Updated numpy type mapping**: Added support for
`ml_dtypes.float8_e8m0fnu`
- **Added type properties**: Configured as 8-bit floating point, signed
type
- **Added short name**: "f8e8m0" for compact representation
- **Updated serialization**: Added FLOAT8E8M0 to appropriate sets in
`serde.py` for proper tensor serialization/deserialization
- **Added tests**: Included parameterized test case and conditional ONNX
compatibility check
## Testing
The implementation includes comprehensive testing:
```python
import onnx_ir._enums as enums
import ml_dtypes
import numpy as np
# Create tensor with FLOAT8E8M0 type
data = np.array([1.0, 2.0, 3.0], dtype=ml_dtypes.float8_e8m0fnu)
tensor = ir_core.Tensor(data)
assert tensor.dtype == enums.DataType.FLOAT8E8M0
# Test properties
assert enums.DataType.FLOAT8E8M0.is_floating_point() == True
assert enums.DataType.FLOAT8E8M0.bitwidth == 8
assert enums.DataType.FLOAT8E8M0.short_name() == 'f8e8m0'
# Test serialization round-trip
tensor_proto = serde.serialize_tensor(tensor)
assert tensor_proto.data_type == 24
```
All existing tests continue to pass, ensuring no regression in
functionality.
Fixesonnx#127.
<!-- START COPILOT CODING AGENT TIPS -->
---
💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.
---------
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: justinchuby <11205048+justinchuby@users.noreply.github.com>
Co-authored-by: Justin Chu <justinchuby@users.noreply.github.com>
0 commit comments