Skip to content

Commit 1815bb9

Browse files
authored
Add ATen and c10 to clang format config. (#9719)
This is a follow-up from #9715. This PR fixes the mentioned PR by adding both `ATen` and `c10` includes to the `.clang-format` file. They were previously mentioned in that file's comments, but were not added to the rules.
1 parent e8d46ef commit 1815bb9

Some content is hidden

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

44 files changed

+70
-87
lines changed

.clang-format

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ IncludeBlocks: Regroup
102102
IncludeCategories:
103103
- Regex: '^<torch/.*>'
104104
Priority: 3
105+
- Regex: '^<ATen/.*>'
106+
Priority: 3
107+
- Regex: '^<c10/.*>'
108+
Priority: 3
105109
- Regex: '^<.*\.h>'
106110
Priority: 1
107111
- Regex: '^<.*'

test/cpp/test_replication.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
#include <ATen/ATen.h>
21
#include <gtest/gtest.h>
32

43
#include <iostream>
54

5+
#include <ATen/ATen.h>
6+
67
#include "absl/synchronization/blocking_counter.h"
78
#include "xla/hlo/builder/xla_builder.h"
89
#include "xla/shape_util.h"

test/cpp/test_status_common.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#ifndef XLA_TEST_CPP_TEST_STATUS_COMMON_H_
1919
#define XLA_TEST_CPP_TEST_STATUS_COMMON_H_
2020

21-
#include <c10/util/Exception.h>
2221
#include <gmock/gmock.h>
2322
#include <gtest/gtest.h>
2423

@@ -27,6 +26,8 @@
2726
#include <stdexcept>
2827
#include <utility>
2928

29+
#include <c10/util/Exception.h>
30+
3031
#include "absl/status/status.h"
3132
#include "absl/status/statusor.h"
3233

test/cpp/test_tensor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
#include <ATen/ATen.h>
21
#include <gtest/gtest.h>
32

43
#include <limits>
54
#include <vector>
65

6+
#include <ATen/ATen.h>
77
#include <torch/csrc/autograd/variable.h>
88

99
#include "absl/base/nullability.h"

test/cpp/test_xla_sharding.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#include <ATen/ATen.h>
21
#include <google/protobuf/repeated_field.h>
32
#include <gtest/gtest.h>
43
#include <stdlib.h>
54

65
#include <iostream>
76

7+
#include <ATen/ATen.h>
88
#include <torch/csrc/lazy/core/lazy_graph_executor.h>
99

1010
#include "xla/protobuf_util.h"

torch_xla/csrc/aten_fallback.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
#include "torch_xla/csrc/aten_fallback.h"
22

3+
#include <unordered_map>
4+
#include <vector>
5+
36
#include <ATen/DLConvertor.h>
47
#include <ATen/native/CPUFallback.h>
58
#include <ATen/ops/_copy_from_and_resize.h>
69
#include <ATen/ops/_to_cpu.h>
7-
8-
#include <unordered_map>
9-
#include <vector>
10-
1110
#include <torch/csrc/utils/device_lazy_init.h>
1211

1312
#include "torch_xla/csrc/function_call_tracker.h"

torch_xla/csrc/aten_xla_bridge.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#include "torch_xla/csrc/aten_xla_bridge.h"
22

3-
#include <ATen/FunctionalTensorWrapper.h>
4-
53
#include <map>
64
#include <string>
75
#include <vector>
86

7+
#include <ATen/FunctionalTensorWrapper.h>
98
#include <torch/csrc/lazy/core/tensor_util.h>
109

1110
#include "absl/log/absl_check.h"

torch_xla/csrc/aten_xla_bridge.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#ifndef XLA_TORCH_XLA_CSRC_ATEN_XLA_BRIDGE_H_
22
#define XLA_TORCH_XLA_CSRC_ATEN_XLA_BRIDGE_H_
33

4+
#include <vector>
5+
46
#include <ATen/Device.h>
57
#include <ATen/Functions.h>
68
#include <ATen/Tensor.h>
79

8-
#include <vector>
9-
1010
#include "absl/base/nullability.h"
1111
#include "absl/status/statusor.h"
1212
#include "absl/types/span.h"

torch_xla/csrc/aten_xla_type.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#include <iterator>
2+
#include <mutex>
3+
#include <optional>
4+
15
#include <ATen/ExpandUtils.h>
26
#include <ATen/FunctionalTensorWrapper.h>
37
#include <ATen/MetaFunctions.h>
@@ -10,11 +14,6 @@
1014
#include <ATen/ops/_embedding_bag_backward_native.h>
1115
#include <ATen/ops/expand_copy.h>
1216
#include <c10/core/Contiguity.h>
13-
14-
#include <iterator>
15-
#include <mutex>
16-
#include <optional>
17-
1817
#include <torch/csrc/lazy/core/helpers.h>
1918
#include <torch/csrc/lazy/core/shape_inference.h>
2019
#include <torch/csrc/lazy/core/tensor_util.h>

torch_xla/csrc/autocast_mode.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <ATen/autocast_mode.h>
55
#include <c10/core/impl/LocalDispatchKeySet.h>
66
#include <c10/util/intrusive_ptr.h>
7-
87
#include <torch/library.h>
98

109
namespace at {

0 commit comments

Comments
 (0)