Unverified Commit d0b32a11 authored by Francisco Massa's avatar Francisco Massa Committed by GitHub
Browse files

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
parent 0777b51e
...@@ -76,7 +76,6 @@ jobs: ...@@ -76,7 +76,6 @@ jobs:
python .circleci/regenerate.py python .circleci/regenerate.py
git diff --exit-code || (echo ".circleci/config.yml not in sync with config.yml.in! Run .circleci/regenerate.py to update config"; exit 1) git diff --exit-code || (echo ".circleci/config.yml not in sync with config.yml.in! Run .circleci/regenerate.py to update config"; exit 1)
python_lint: python_lint:
docker: docker:
- image: circleci/python:3.7 - image: circleci/python:3.7
...@@ -87,6 +86,17 @@ jobs: ...@@ -87,6 +86,17 @@ jobs:
pip install --user --progress-bar off flake8 typing pip install --user --progress-bar off flake8 typing
flake8 . flake8 .
clang_format:
docker:
- image: circleci/python:3.7
steps:
- checkout
- run:
command: |
sudo apt-get update -y
sudo apt-get install -y clang-format
./travis-scripts/run-clang-format/run-clang-format.py -r torchvision/csrc
binary_linux_wheel: binary_linux_wheel:
<<: *binary_common <<: *binary_common
docker: docker:
...@@ -521,11 +531,13 @@ workflows: ...@@ -521,11 +531,13 @@ workflows:
python_version: "3.6" python_version: "3.6"
cu_version: "cu101" cu_version: "cu101"
- python_lint - python_lint
- clang_format
nightly: nightly:
jobs: jobs:
- circleci_consistency - circleci_consistency
- python_lint
- clang_format
- binary_linux_wheel: - binary_linux_wheel:
cu_version: cpu cu_version: cpu
filters: filters:
......
...@@ -76,7 +76,6 @@ jobs: ...@@ -76,7 +76,6 @@ jobs:
python .circleci/regenerate.py python .circleci/regenerate.py
git diff --exit-code || (echo ".circleci/config.yml not in sync with config.yml.in! Run .circleci/regenerate.py to update config"; exit 1) git diff --exit-code || (echo ".circleci/config.yml not in sync with config.yml.in! Run .circleci/regenerate.py to update config"; exit 1)
python_lint: python_lint:
docker: docker:
- image: circleci/python:3.7 - image: circleci/python:3.7
...@@ -87,6 +86,17 @@ jobs: ...@@ -87,6 +86,17 @@ jobs:
pip install --user --progress-bar off flake8 typing pip install --user --progress-bar off flake8 typing
flake8 . flake8 .
clang_format:
docker:
- image: circleci/python:3.7
steps:
- checkout
- run:
command: |
sudo apt-get update -y
sudo apt-get install -y clang-format
./travis-scripts/run-clang-format/run-clang-format.py -r torchvision/csrc
binary_linux_wheel: binary_linux_wheel:
<<: *binary_common <<: *binary_common
docker: docker:
...@@ -323,10 +333,12 @@ workflows: ...@@ -323,10 +333,12 @@ workflows:
python_version: "3.6" python_version: "3.6"
cu_version: "cu101" cu_version: "cu101"
- python_lint - python_lint
- clang_format
nightly: nightly:
{%- endif %} {%- endif %}
jobs: jobs:
- circleci_consistency - circleci_consistency
- python_lint
- clang_format
{{ workflows(prefix="nightly_", filter_branch="nightly", upload=True) }} {{ workflows(prefix="nightly_", filter_branch="nightly", upload=True) }}
...@@ -3,18 +3,6 @@ language: python ...@@ -3,18 +3,6 @@ language: python
dist: xenial dist: xenial
matrix: matrix:
include: include:
- env: FORMAT_CHECK
language: cpp
addons:
apt:
sources:
- llvm-toolchain-xenial-7
packages:
- clang-7
- clang-format-7
before_install: skip
install: skip
script: ./travis-scripts/run-clang-format/run-clang-format.py -r torchvision/csrc
- python: "3.6" - python: "3.6"
env: IMAGE_BACKEND=Pillow-SIMD env: IMAGE_BACKEND=Pillow-SIMD
- python: "3.6" - python: "3.6"
......
...@@ -393,7 +393,7 @@ at::Tensor DeformConv2d_forward_cpu( ...@@ -393,7 +393,7 @@ at::Tensor DeformConv2d_forward_cpu(
.view_as(out_buf[b][g]); .view_as(out_buf[b][g]);
} }
columns = columns =
columns.view({columns.size(0) * columns.size(1), columns.size(2)}); columns.view({columns.size(0) * columns.size(1), columns.size(2)});
} }
out_buf = out_buf.view({batch_sz / n_parallel_imgs, 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( ...@@ -733,12 +733,14 @@ static std::tuple<at::Tensor, at::Tensor> deform_conv2d_backward_input_cpu(
out_h, out_h,
out_w}); out_w});
grad_out = grad_out.reshape({batch_sz / n_parallel_imgs, grad_out = grad_out
n_parallel_imgs, .reshape({batch_sz / n_parallel_imgs,
n_weight_grps, n_parallel_imgs,
n_out_channels / n_weight_grps, n_weight_grps,
out_h, n_out_channels / n_weight_grps,
out_w}).permute({0, 2, 3, 1, 4, 5}); out_h,
out_w})
.permute({0, 2, 3, 1, 4, 5});
weight = weight.reshape({n_weight_grps, weight = weight.reshape({n_weight_grps,
weight.size(0) / n_weight_grps, weight.size(0) / n_weight_grps,
...@@ -838,14 +840,15 @@ static at::Tensor deform_conv2d_backward_parameters_cpu( ...@@ -838,14 +840,15 @@ static at::Tensor deform_conv2d_backward_parameters_cpu(
auto grad_weight = at::zeros_like(weight); auto grad_weight = at::zeros_like(weight);
at::Tensor grad_out_buf = grad_out.reshape( at::Tensor grad_out_buf = grad_out
{batch_sz / n_parallel_imgs, .reshape({batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_weight_grps, n_weight_grps,
n_out_channels / n_weight_grps, n_out_channels / n_weight_grps,
out_h, out_h,
out_w} out_w})
).permute({0, 2, 3, 1, 4, 5}).contiguous(); .permute({0, 2, 3, 1, 4, 5})
.contiguous();
input = input.reshape( input = input.reshape(
{batch_sz / n_parallel_imgs, n_parallel_imgs, n_in_channels, in_h, in_w}); {batch_sz / n_parallel_imgs, n_parallel_imgs, n_in_channels, in_h, in_w});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment