Skip to content

Commit a5e6375

Browse files
authored
Merge branch 'main' into oops
2 parents d7aea43 + b47ea83 commit a5e6375

File tree

224 files changed

+5551
-1813
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+5551
-1813
lines changed

.circleci/config.yml

Lines changed: 9 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.circleci/config.yml.in

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ jobs:
187187
pip install --user --progress-bar off pre-commit
188188
pre-commit install-hooks
189189
- run: pre-commit run --all-files
190+
- run:
191+
name: Required lint modifications
192+
when: on_fail
193+
command: git --no-pager diff
190194

191195
python_type_check:
192196
docker:
@@ -269,11 +273,13 @@ jobs:
269273
name: Install torchvision
270274
command: pip install --user --progress-bar off --no-build-isolation .
271275
- run:
272-
name: Install test utilities
273-
command: pip install --user --progress-bar=off pytest
276+
name: Install test requirements
277+
command: pip install --user --progress-bar=off pytest pytest-mock scipy iopath
274278
- run:
275279
name: Run tests
276-
command: pytest test/test_prototype_*.py
280+
command: pytest --junitxml=test-results/junit.xml -v --durations 20 test/test_prototype_*.py
281+
- store_test_results:
282+
path: test-results
277283

278284
binary_linux_wheel:
279285
<<: *binary_common

.circleci/unittest/linux/scripts/install.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ conda activate ./env
1212

1313
if [ "${CU_VERSION:-}" == cpu ] ; then
1414
cudatoolkit="cpuonly"
15+
version="cpu"
1516
else
1617
if [[ ${#CU_VERSION} -eq 4 ]]; then
1718
CUDA_VERSION="${CU_VERSION:2:1}.${CU_VERSION:3:1}"
@@ -23,8 +24,17 @@ else
2324
cudatoolkit="cudatoolkit=${version}"
2425
fi
2526

27+
case "$(uname -s)" in
28+
Darwin*) os=MacOSX;;
29+
*) os=Linux
30+
esac
31+
2632
printf "Installing PyTorch with %s\n" "${cudatoolkit}"
27-
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" "pytorch-${UPLOAD_CHANNEL}"::pytorch "${cudatoolkit}" pytest
33+
if [ "${os}" == "MacOSX" ]; then
34+
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" "pytorch-${UPLOAD_CHANNEL}"::pytorch "${cudatoolkit}" pytest
35+
else
36+
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" "pytorch-${UPLOAD_CHANNEL}"::pytorch[build="*${version}*"] "${cudatoolkit}" pytest
37+
fi
2838

2939
if [ $PYTHON_VERSION == "3.6" ]; then
3040
printf "Installing minimal PILLOW version\n"

.circleci/unittest/linux/scripts/run-clang-format.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import argparse
3535
import difflib
3636
import fnmatch
37-
import io
3837
import multiprocessing
3938
import os
4039
import signal
@@ -87,20 +86,20 @@ def list_files(files, recursive=False, extensions=None, exclude=None):
8786
def make_diff(file, original, reformatted):
8887
return list(
8988
difflib.unified_diff(
90-
original, reformatted, fromfile="{}\t(original)".format(file), tofile="{}\t(reformatted)".format(file), n=3
89+
original, reformatted, fromfile=f"{file}\t(original)", tofile=f"{file}\t(reformatted)", n=3
9190
)
9291
)
9392

9493

9594
class DiffError(Exception):
9695
def __init__(self, message, errs=None):
97-
super(DiffError, self).__init__(message)
96+
super().__init__(message)
9897
self.errs = errs or []
9998

10099

101100
class UnexpectedError(Exception):
102101
def __init__(self, message, exc=None):
103-
super(UnexpectedError, self).__init__(message)
102+
super().__init__(message)
104103
self.formatted_traceback = traceback.format_exc()
105104
self.exc = exc
106105

@@ -112,14 +111,14 @@ def run_clang_format_diff_wrapper(args, file):
112111
except DiffError:
113112
raise
114113
except Exception as e:
115-
raise UnexpectedError("{}: {}: {}".format(file, e.__class__.__name__, e), e)
114+
raise UnexpectedError(f"{file}: {e.__class__.__name__}: {e}", e)
116115

117116

118117
def run_clang_format_diff(args, file):
119118
try:
120-
with io.open(file, "r", encoding="utf-8") as f:
119+
with open(file, encoding="utf-8") as f:
121120
original = f.readlines()
122-
except IOError as exc:
121+
except OSError as exc:
123122
raise DiffError(str(exc))
124123
invocation = [args.clang_format_executable, file]
125124

@@ -145,7 +144,7 @@ def run_clang_format_diff(args, file):
145144
invocation, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, encoding="utf-8"
146145
)
147146
except OSError as exc:
148-
raise DiffError("Command '{}' failed to start: {}".format(subprocess.list2cmdline(invocation), exc))
147+
raise DiffError(f"Command '{subprocess.list2cmdline(invocation)}' failed to start: {exc}")
149148
proc_stdout = proc.stdout
150149
proc_stderr = proc.stderr
151150

@@ -203,7 +202,7 @@ def print_trouble(prog, message, use_colors):
203202
error_text = "error:"
204203
if use_colors:
205204
error_text = bold_red(error_text)
206-
print("{}: {} {}".format(prog, error_text, message), file=sys.stderr)
205+
print(f"{prog}: {error_text} {message}", file=sys.stderr)
207206

208207

209208
def main():
@@ -216,7 +215,7 @@ def main():
216215
)
217216
parser.add_argument(
218217
"--extensions",
219-
help="comma separated list of file extensions (default: {})".format(DEFAULT_EXTENSIONS),
218+
help=f"comma separated list of file extensions (default: {DEFAULT_EXTENSIONS})",
220219
default=DEFAULT_EXTENSIONS,
221220
)
222221
parser.add_argument("-r", "--recursive", action="store_true", help="run recursively over directories")
@@ -227,7 +226,7 @@ def main():
227226
metavar="N",
228227
type=int,
229228
default=0,
230-
help="run N clang-format jobs in parallel" " (default number of cpus + 1)",
229+
help="run N clang-format jobs in parallel (default number of cpus + 1)",
231230
)
232231
parser.add_argument(
233232
"--color", default="auto", choices=["auto", "always", "never"], help="show colored diff (default: auto)"
@@ -238,7 +237,7 @@ def main():
238237
metavar="PATTERN",
239238
action="append",
240239
default=[],
241-
help="exclude paths matching the given glob-like pattern(s)" " from recursive search",
240+
help="exclude paths matching the given glob-like pattern(s) from recursive search",
242241
)
243242

244243
args = parser.parse_args()
@@ -263,7 +262,7 @@ def main():
263262
colored_stdout = sys.stdout.isatty()
264263
colored_stderr = sys.stderr.isatty()
265264

266-
version_invocation = [args.clang_format_executable, str("--version")]
265+
version_invocation = [args.clang_format_executable, "--version"]
267266
try:
268267
subprocess.check_call(version_invocation, stdout=DEVNULL)
269268
except subprocess.CalledProcessError as e:
@@ -272,7 +271,7 @@ def main():
272271
except OSError as e:
273272
print_trouble(
274273
parser.prog,
275-
"Command '{}' failed to start: {}".format(subprocess.list2cmdline(version_invocation), e),
274+
f"Command '{subprocess.list2cmdline(version_invocation)}' failed to start: {e}",
276275
use_colors=colored_stderr,
277276
)
278277
return ExitStatus.TROUBLE

.circleci/unittest/windows/scripts/install.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
1212
eval "$(./conda/Scripts/conda.exe 'shell.bash' 'hook')"
1313
conda activate ./env
1414

15+
# TODO, refactor the below logic to make it easy to understand how to get correct cuda_version.
1516
if [ "${CU_VERSION:-}" == cpu ] ; then
1617
cudatoolkit="cpuonly"
18+
version="cpu"
1719
else
1820
if [[ ${#CU_VERSION} -eq 4 ]]; then
1921
CUDA_VERSION="${CU_VERSION:2:1}.${CU_VERSION:3:1}"
@@ -26,8 +28,7 @@ else
2628
fi
2729

2830
printf "Installing PyTorch with %s\n" "${cudatoolkit}"
29-
# conda-forge channel is required for cudatoolkit 11.1 on Windows, see https://github.com/pytorch/vision/issues/4458
30-
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" -c conda-forge "pytorch-${UPLOAD_CHANNEL}"::pytorch "${cudatoolkit}" pytest
31+
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" -c conda-forge "pytorch-${UPLOAD_CHANNEL}"::pytorch[build="*${version}*"] "${cudatoolkit}" pytest
3132

3233
if [ $PYTHON_VERSION == "3.6" ]; then
3334
printf "Installing minimal PILLOW version\n"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ docs/build
1414
# sphinx-gallery
1515
docs/source/auto_examples/
1616
docs/source/gen_modules/
17+
docs/source/generated/
1718
# pytorch-sphinx-theme gets installed here
1819
docs/src
1920

.pre-commit-config.yaml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
11
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.0.1
4+
hooks:
5+
- id: check-docstring-first
6+
- id: check-toml
7+
- id: check-yaml
8+
exclude: packaging/.*
9+
- id: end-of-file-fixer
10+
11+
# - repo: https://github.com/asottile/pyupgrade
12+
# rev: v2.29.0
13+
# hooks:
14+
# - id: pyupgrade
15+
# args: [--py36-plus]
16+
# name: Upgrade code
17+
218
- repo: https://github.com/omnilib/ufmt
319
rev: v1.3.0
420
hooks:
521
- id: ufmt
622
additional_dependencies:
723
- black == 21.9b0
824
- usort == 0.6.4
25+
926
- repo: https://gitlab.com/pycqa/flake8
1027
rev: 3.9.2
1128
hooks:
1229
- id: flake8
1330
args: [--config=setup.cfg]
14-
- repo: https://github.com/pre-commit/pre-commit-hooks
15-
rev: v4.0.1
16-
hooks:
17-
- id: check-docstring-first
18-
- id: check-toml
19-
- id: check-yaml
20-
exclude: packaging/.*
21-
- id: end-of-file-fixer

README.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ supported Python versions.
2323
+==========================+==========================+=================================+
2424
| ``main`` / ``nightly`` | ``main`` / ``nightly`` | ``>=3.6``, ``<=3.9`` |
2525
+--------------------------+--------------------------+---------------------------------+
26+
| ``1.10.0`` | ``0.11.1`` | ``>=3.6``, ``<=3.9`` |
27+
+--------------------------+--------------------------+---------------------------------+
28+
| ``1.9.1`` | ``0.10.1`` | ``>=3.6``, ``<=3.9`` |
29+
+--------------------------+--------------------------+---------------------------------+
2630
| ``1.9.0`` | ``0.10.0`` | ``>=3.6``, ``<=3.9`` |
2731
+--------------------------+--------------------------+---------------------------------+
2832
| ``1.8.2`` | ``0.9.2`` | ``>=3.6``, ``<=3.9`` |

docs/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ clean:
3232
rm -rf $(BUILDDIR)/*
3333
rm -rf $(SOURCEDIR)/auto_examples/ # sphinx-gallery
3434
rm -rf $(SOURCEDIR)/gen_modules/ # sphinx-gallery
35+
rm -rf $(SOURCEDIR)/generated/ # autosummary
3536

3637
.PHONY: help Makefile docset
3738

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ numpy
33
sphinx-copybutton>=0.3.1
44
sphinx-gallery>=0.9.0
55
sphinx==3.5.4
6-
-e git+git://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
6+
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme

0 commit comments

Comments
 (0)