Open
Description
Problem Description
The current tf2onnx conversion test in jupyter/rocm/tensorflow/ubi9-python-3.12/test/test_notebook.ipynb
provides insufficient validation of the ONNX model conversion process. The test only checks that the conversion result is not None, which doesn't validate the actual functionality or structure of the converted ONNX model.
Current Implementation
def test_tf2onnx_conversion(self):
model = tf.keras.Sequential([tf.keras.layers.Dense(1, input_shape=(10,))])
onnx_model = tf2onnx.convert.from_keras(model)
self.assertTrue(onnx_model is not None)
Expected Enhancement
The test should include comprehensive validation of the ONNX model structure and properties:
def test_tf2onnx_conversion(self):
model = tf.keras.Sequential([tf.keras.layers.Dense(1, input_shape=(10,))])
onnx_model, _ = tf2onnx.convert.from_keras(model)
self.assertTrue(onnx_model is not None)
# Verify ONNX model has expected structure
self.assertTrue(hasattr(onnx_model, 'graph'), "ONNX model should have a graph")
self.assertTrue(len(onnx_model.graph.node) > 0, "ONNX model should have nodes")
Acceptance Criteria
- Update the
test_tf2onnx_conversion
method to properly handle the tuple return value fromtf2onnx.convert.from_keras()
- Add validation that the ONNX model has a
graph
attribute - Add validation that the ONNX model graph contains nodes (not empty)
- Consider adding additional validations such as:
- Input/output tensor shape validation
- Model op type verification
- Basic inference test with sample data
Context
This enhancement improves test robustness by ensuring that the tf2onnx conversion actually produces a valid, structured ONNX model rather than just a non-null result. This is particularly important for ROCm environments where conversion compatibility may vary.
References
- PR: RHOAIENG-27434: Create Rocm Tensorflow Python 3.12 Image #1259
- Comment: RHOAIENG-27434: Create Rocm Tensorflow Python 3.12 Image #1259 (comment)
- File:
jupyter/rocm/tensorflow/ubi9-python-3.12/test/test_notebook.ipynb
(lines 48-53) - Reported by: @jiridanek
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status