feat: Generalize operator extraction script for unit testing #257
Open
Zane-Jiang wants to merge 3 commits intosophgo:masterfrom
Open
feat: Generalize operator extraction script for unit testing #257Zane-Jiang wants to merge 3 commits intosophgo:masterfrom
Zane-Jiang wants to merge 3 commits intosophgo:masterfrom
Conversation
- Implement onnx/torch operator extraction in extract_op.py, used to extract operator case shapes and parameters from MLIR files into a JSON file. - Add options `--json_file` and `--case_id` to test_onnx.py to load JSON files as test case inputs for operator testing. - Only a subset of basic and commonly used operators is supported.
- Remove reduant quotation marks during type convert
|
感谢您的工作, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this pr do?
Fix issue #238
Implement onnx/torch operator extraction in extract_op.py, used to extract operator case shapes and parameters from MLIR files into a JSON file.
Add options
--json_fileand--case_idto test_onnx.py to load JSON files as test case inputs for operator testing.Only a subset of basic and commonly used operators is supported.
Usage:
1.extract
extract_op.py --framework {onnx,torch} --op {Abs,Add,Sub,Mul,Div,AddConst,And,Relu,Concat,Compare,Softmax} mlir_file output_json #eg extract_op.py onnx_test_bm1684x/Add/Add.mlir op_add.json --framework=onnx --op=Add2.test
test_onnx.py --json_file=xxx --case_id=0 --case=xxx #eg test_onnx.py --json_file=op_add.json --case_id=0 --case=Add