Skip to content

Commit d0b32a1

Browse files
authored
Add clang-format to CircleCI (#2057)
* Add clang-format to CircleCI * Fix for clang-format version * Fix lint and remove Travis CI * Seeing if lost commit comes back * Fix lint * Re-enable all tests
1 parent 0777b51 commit d0b32a1

File tree

4 files changed

+46
-31
lines changed

4 files changed

+46
-31
lines changed

.circleci/config.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ jobs:
7676
python .circleci/regenerate.py
7777
git diff --exit-code || (echo ".circleci/config.yml not in sync with config.yml.in! Run .circleci/regenerate.py to update config"; exit 1)
7878
79-
8079
python_lint:
8180
docker:
8281
- image: circleci/python:3.7
@@ -87,6 +86,17 @@ jobs:
8786
pip install --user --progress-bar off flake8 typing
8887
flake8 .
8988
89+
clang_format:
90+
docker:
91+
- image: circleci/python:3.7
92+
steps:
93+
- checkout
94+
- run:
95+
command: |
96+
sudo apt-get update -y
97+
sudo apt-get install -y clang-format
98+
./travis-scripts/run-clang-format/run-clang-format.py -r torchvision/csrc
99+
90100
binary_linux_wheel:
91101
<<: *binary_common
92102
docker:
@@ -521,11 +531,13 @@ workflows:
521531
python_version: "3.6"
522532
cu_version: "cu101"
523533
- python_lint
524-
534+
- clang_format
525535

526536
nightly:
527537
jobs:
528538
- circleci_consistency
539+
- python_lint
540+
- clang_format
529541
- binary_linux_wheel:
530542
cu_version: cpu
531543
filters:

.circleci/config.yml.in

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ jobs:
7676
python .circleci/regenerate.py
7777
git diff --exit-code || (echo ".circleci/config.yml not in sync with config.yml.in! Run .circleci/regenerate.py to update config"; exit 1)
7878

79-
8079
python_lint:
8180
docker:
8281
- image: circleci/python:3.7
@@ -87,6 +86,17 @@ jobs:
8786
pip install --user --progress-bar off flake8 typing
8887
flake8 .
8988

89+
clang_format:
90+
docker:
91+
- image: circleci/python:3.7
92+
steps:
93+
- checkout
94+
- run:
95+
command: |
96+
sudo apt-get update -y
97+
sudo apt-get install -y clang-format
98+
./travis-scripts/run-clang-format/run-clang-format.py -r torchvision/csrc
99+
90100
binary_linux_wheel:
91101
<<: *binary_common
92102
docker:
@@ -323,10 +333,12 @@ workflows:
323333
python_version: "3.6"
324334
cu_version: "cu101"
325335
- python_lint
326-
336+
- clang_format
327337

328338
nightly:
329339
{%- endif %}
330340
jobs:
331341
- circleci_consistency
342+
- python_lint
343+
- clang_format
332344
{{ workflows(prefix="nightly_", filter_branch="nightly", upload=True) }}

.travis.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,6 @@ language: python
33
dist: xenial
44
matrix:
55
include:
6-
- env: FORMAT_CHECK
7-
language: cpp
8-
addons:
9-
apt:
10-
sources:
11-
- llvm-toolchain-xenial-7
12-
packages:
13-
- clang-7
14-
- clang-format-7
15-
before_install: skip
16-
install: skip
17-
script: ./travis-scripts/run-clang-format/run-clang-format.py -r torchvision/csrc
186
- python: "3.6"
197
env: IMAGE_BACKEND=Pillow-SIMD
208
- python: "3.6"

torchvision/csrc/cpu/DeformConv_cpu.cpp

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ at::Tensor DeformConv2d_forward_cpu(
393393
.view_as(out_buf[b][g]);
394394
}
395395
columns =
396-
columns.view({columns.size(0) * columns.size(1), columns.size(2)});
396+
columns.view({columns.size(0) * columns.size(1), columns.size(2)});
397397
}
398398

399399
out_buf = out_buf.view({batch_sz / n_parallel_imgs,
@@ -733,12 +733,14 @@ static std::tuple<at::Tensor, at::Tensor> deform_conv2d_backward_input_cpu(
733733
out_h,
734734
out_w});
735735

736-
grad_out = grad_out.reshape({batch_sz / n_parallel_imgs,
737-
n_parallel_imgs,
738-
n_weight_grps,
739-
n_out_channels / n_weight_grps,
740-
out_h,
741-
out_w}).permute({0, 2, 3, 1, 4, 5});
736+
grad_out = grad_out
737+
.reshape({batch_sz / n_parallel_imgs,
738+
n_parallel_imgs,
739+
n_weight_grps,
740+
n_out_channels / n_weight_grps,
741+
out_h,
742+
out_w})
743+
.permute({0, 2, 3, 1, 4, 5});
742744

743745
weight = weight.reshape({n_weight_grps,
744746
weight.size(0) / n_weight_grps,
@@ -838,14 +840,15 @@ static at::Tensor deform_conv2d_backward_parameters_cpu(
838840

839841
auto grad_weight = at::zeros_like(weight);
840842

841-
at::Tensor grad_out_buf = grad_out.reshape(
842-
{batch_sz / n_parallel_imgs,
843-
n_parallel_imgs,
844-
n_weight_grps,
845-
n_out_channels / n_weight_grps,
846-
out_h,
847-
out_w}
848-
).permute({0, 2, 3, 1, 4, 5}).contiguous();
843+
at::Tensor grad_out_buf = grad_out
844+
.reshape({batch_sz / n_parallel_imgs,
845+
n_parallel_imgs,
846+
n_weight_grps,
847+
n_out_channels / n_weight_grps,
848+
out_h,
849+
out_w})
850+
.permute({0, 2, 3, 1, 4, 5})
851+
.contiguous();
849852

850853
input = input.reshape(
851854
{batch_sz / n_parallel_imgs, n_parallel_imgs, n_in_channels, in_h, in_w});

0 commit comments

Comments
 (0)