mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Fix onnx custom op export & add initial test case (#21321)
Summary: - Fix typo in ```torch/onnx/utils.py``` when looking up registered custom ops. - Add a simple test case 1. Register custom op with ```TorchScript``` using ```cpp_extension.load_inline```. 2. Register custom op with ```torch.onnx.symbolic``` using ```register_custom_op_symbolic```. 3. Export model with custom op, and verify with Caffe2 backend. Pull Request resolved: https://github.com/pytorch/pytorch/pull/21321 Differential Revision: D16101097 Pulled By: houseroad fbshipit-source-id: 084f8b55e230e1cb6e9bd7bd52d7946cefda8e33
This commit is contained in:
committed by
Facebook Github Bot
parent
9c44f6c723
commit
319ef3bcbb
@ -24,6 +24,11 @@ done
|
||||
set -- "${UNKNOWN[@]}" # leave UNKNOWN
|
||||
|
||||
pip install pytest scipy hypothesis
|
||||
# JIT C++ extensions require ninja.
|
||||
pip install ninja --user
|
||||
# ninja is installed in /var/lib/jenkins/.local/bin
|
||||
export PATH="/var/lib/jenkins/.local/bin:$PATH"
|
||||
|
||||
if [[ $PARALLEL == 1 ]]; then
|
||||
pip install pytest-xdist
|
||||
fi
|
||||
@ -49,11 +54,14 @@ pytest "${args[@]}" \
|
||||
-k \
|
||||
'not (TestOperators and test_full_like) and not (TestOperators and test_zeros_like) and not (TestOperators and test_ones_like) and not (TestModels and test_vgg16) and not (TestModels and test_vgg16_bn) and not (TestModels and test_vgg19) and not (TestModels and test_vgg19_bn)' \
|
||||
--ignore "$top_dir/test/onnx/test_pytorch_onnx_onnxruntime.py" \
|
||||
--ignore "$top_dir/test/onnx/test_custom_ops.py" \
|
||||
"${test_paths[@]}"
|
||||
|
||||
# onnxruntime only support py3
|
||||
# "Python.h" not found in py2, needed by TorchScript custom op compilation.
|
||||
if [[ "$BUILD_ENVIRONMENT" == *py3* ]]; then
|
||||
pip install --user onnxruntime
|
||||
pytest "${args[@]}" "$top_dir/test/onnx/test_pytorch_onnx_onnxruntime.py"
|
||||
pytest "${args[@]}" "$top_dir/test/onnx/test_custom_ops.py"
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user