Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance ONNX importer with better error handling and output support. #3971

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stutimi
Copy link

@stutimi stutimi commented Jan 18, 2025

This pull request enhances the ONNX importer for torch-mlir by improving error handling, resource management, and output feedback. It addresses potential edge cases in file handling and provides a more user-friendly experience during the import process.

Key Changes
Improved Error Handling:

Added detailed error messages for input file parsing and output file saving.
Checked file streams for proper opening and handling edge cases gracefully.
Resource Management:

Utilized RAII for managing MLIR context and module lifecycle, ensuring proper cleanup.
Enhanced Feedback:

Added meaningful console logs for various stages of the import process.
Highlighted issues during the import with clear error messages.
Optional Output File Support:

Enabled saving the MLIR module to a specified output file for further processing or debugging.
Testing
Tested with multiple ONNX files to verify successful parsing and importing.
Verified proper error messages when provided invalid or missing files.
Ensured output MLIR module is correctly written to a file or displayed as per the command-line arguments.
Why Merge This?
This improvement makes the ONNX importer more robust and user-friendly, reducing the likelihood of user errors and improving debugging capabilities. The changes align with best practices for C++ development and maintainability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant