mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Summary: This is an extension to the original PR https://github.com/pytorch/pytorch/pull/21765 1. Increase the coverage of different opsets support, comments, and blacklisting. 2. Adding backend tests for both caffe2 and onnxruntime on opset 7 and opset 8. 3. Reusing onnx model tests in caffe2 for onnxruntime. Pull Request resolved: https://github.com/pytorch/pytorch/pull/22421 Reviewed By: zrphercule Differential Revision: D16225518 Pulled By: houseroad fbshipit-source-id: 01ae3eed85111a83a0124e9e95512b80109d6aee
70 lines
2.0 KiB
Bash
Executable File
70 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -ex
|
|
|
|
UNKNOWN=()
|
|
|
|
# defaults
|
|
PARALLEL=0
|
|
|
|
while [[ $# -gt 0 ]]
|
|
do
|
|
arg="$1"
|
|
case $arg in
|
|
-p|--parallel)
|
|
PARALLEL=1
|
|
shift # past argument
|
|
;;
|
|
*) # unknown option
|
|
UNKNOWN+=("$1") # save it in an array for later
|
|
shift # past argument
|
|
;;
|
|
esac
|
|
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
|
|
|
|
# realpath might not be available on MacOS
|
|
script_path=$(python -c "import os; import sys; print(os.path.realpath(sys.argv[1]))" "${BASH_SOURCE[0]}")
|
|
top_dir=$(dirname $(dirname $(dirname "$script_path")))
|
|
test_paths=(
|
|
"$top_dir/test/onnx"
|
|
)
|
|
|
|
args=()
|
|
args+=("-v")
|
|
if [[ $PARALLEL == 1 ]]; then
|
|
args+=("-n")
|
|
args+=("3")
|
|
fi
|
|
|
|
# These exclusions are for tests that take a long time / a lot of GPU
|
|
# memory to run; they should be passing (and you will test them if you
|
|
# run them locally
|
|
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" \
|
|
--ignore "$top_dir/test/onnx/test_models_onnxruntime.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"
|
|
pytest "${args[@]}" "$top_dir/test/onnx/test_models_onnxruntime.py"
|
|
fi
|
|
|