Skip to content

Commit 8f1c3c6

Browse files
malfetpytorchmergebot
authored andcommitted
[BE] Use nested namespaces in .cpp/.cu files (pytorch#92100)
As we live in C++17 world This is a functional no-op, just - `s/namespace at { namespace native {/namespace at::native {/` - `s/namespace torch { namespace jit {/namespace torch::jit {/` Pull Request resolved: pytorch#92100 Approved by: https://github.com/izaitsevfb
1 parent a4a0195 commit 8f1c3c6

File tree

412 files changed

+941
-1575
lines changed

Some content is hidden

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

412 files changed

+941
-1575
lines changed

aten/src/ATen/ConjugateFallback.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#include <ATen/native/MathBitsFallback.h>
22
#include <ATen/native/MathBitFallThroughLists.h>
33

4-
namespace at {
5-
namespace native {
4+
namespace at::native {
65
struct ConjFallback : MathOpFallback {
76
ConjFallback() : MathOpFallback(DispatchKey::Conjugate, "conjugate") {}
87
bool is_bit_set(const Tensor& tensor) override {
@@ -63,5 +62,4 @@ TORCH_LIBRARY_IMPL(aten, Conjugate, m) {
6362
TORCH_VIEW_FNS_NATIVE_FN_REGISTRATION(m)
6463
}
6564

66-
}
67-
} // namespace at
65+
} // namespace at::native

aten/src/ATen/Dispatch.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <ATen/Dispatch.h>
22
#include <ATen/record_function.h>
33

4-
namespace at { namespace detail {
4+
namespace at::detail {
55

66
void record_kernel_function_dtype(std::string name) {
77
RECORD_FUNCTION_WITH_SCOPE(
@@ -10,4 +10,4 @@ void record_kernel_function_dtype(std::string name) {
1010
c10::ArrayRef<const c10::IValue>{});
1111
}
1212

13-
}} // namespace at::detail
13+
} // namespace at::detail

aten/src/ATen/native/cpu/Activation.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919

2020
#include <c10/core/Scalar.h>
2121

22-
namespace at {
23-
namespace native {
22+
namespace at::native {
2423

2524
namespace {
2625

@@ -1403,5 +1402,4 @@ REGISTER_DISPATCH(mish_backward_stub, &mish_backward_kernel);
14031402
REGISTER_DISPATCH(prelu_stub, &prelu_kernel);
14041403
REGISTER_DISPATCH(prelu_backward_stub, &prelu_backward_kernel);
14051404

1406-
} // namespace native
1407-
} // namespace at
1405+
} // namespace at::native

aten/src/ATen/native/cpu/AdaptiveAvgPoolKernel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <ATen/native/cpu/utils.h>
99
#include <c10/util/irange.h>
1010

11-
namespace at { namespace native {
11+
namespace at::native {
1212

1313
namespace {
1414

@@ -413,4 +413,4 @@ void adapative_avg_pool2d_backward_kernel_impl(
413413
REGISTER_DISPATCH(adaptive_avg_pool2d_kernel, &adaptive_avg_pool2d_kernel_impl);
414414
REGISTER_DISPATCH(adaptive_avg_pool2d_backward_kernel, &adapative_avg_pool2d_backward_kernel_impl);
415415

416-
}} // at::native
416+
} // at::native

aten/src/ATen/native/cpu/AdaptiveMaxPoolKernel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <ATen/native/cpu/utils.h>
99
#include <c10/util/irange.h>
1010

11-
namespace at { namespace native {
11+
namespace at::native {
1212

1313
namespace {
1414

@@ -485,4 +485,4 @@ void adaptive_max_pool2d_backward_kernel_impl(
485485
REGISTER_DISPATCH(adaptive_max_pool2d_kernel, &adaptive_max_pool2d_kernel_impl);
486486
REGISTER_DISPATCH(adaptive_max_pool2d_backward_kernel, &adaptive_max_pool2d_backward_kernel_impl);
487487

488-
}} // at::native
488+
} // at::native

aten/src/ATen/native/cpu/AvgPoolKernel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <ATen/native/cpu/utils.h>
88
#include <c10/util/irange.h>
99

10-
namespace at { namespace native {
10+
namespace at::native {
1111

1212
namespace {
1313

@@ -549,4 +549,4 @@ void avg_pool2d_backward_kernel_impl(
549549
REGISTER_DISPATCH(avg_pool2d_kernel, &avg_pool2d_kernel_impl);
550550
REGISTER_DISPATCH(avg_pool2d_backward_kernel, &avg_pool2d_backward_kernel_impl);
551551

552-
}} // at::native
552+
} // at::native

aten/src/ATen/native/cpu/BinaryOpsKernel.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
#include <c10/util/TypeSafeSignMath.h>
1616
#include <c10/util/copysign.h>
1717

18-
namespace at {
19-
namespace native {
18+
namespace at::native {
2019

2120
namespace {
2221

@@ -1273,5 +1272,4 @@ REGISTER_DISPATCH(shifted_chebyshev_polynomial_u_stub, &shifted_chebyshev_polyno
12731272
REGISTER_DISPATCH(shifted_chebyshev_polynomial_v_stub, &shifted_chebyshev_polynomial_v_kernel);
12741273
REGISTER_DISPATCH(shifted_chebyshev_polynomial_w_stub, &shifted_chebyshev_polynomial_w_kernel);
12751274

1276-
} // namespace native
1277-
} // namespace at
1275+
} // namespace at::native

aten/src/ATen/native/cpu/BlasKernel.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
#include <c10/util/irange.h>
55
#include <c10/util/Unroll.h>
66

7-
namespace at {
8-
namespace native {
7+
namespace at::native {
98
namespace cpublas {
109
namespace {
1110

@@ -248,4 +247,4 @@ REGISTER_DISPATCH(cpublas::gemm_stub, &cpublas::cpublas_gemm_impl);
248247
REGISTER_DISPATCH(cpublas::axpy_stub, &cpublas::cpublas_axpy_impl);
249248
REGISTER_DISPATCH(cpublas::copy_stub, &cpublas::cpublas_copy_impl);
250249

251-
}} // namespace at::native
250+
} // namespace at::native

aten/src/ATen/native/cpu/CatKernel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <ATen/cpu/vec/vec.h>
88
#include <c10/util/irange.h>
99

10-
namespace at { namespace native {
10+
namespace at::native {
1111

1212
namespace {
1313

@@ -65,4 +65,4 @@ void cat_serial_kernel(const Tensor& result, const MaterializedITensorListRef& t
6565

6666
REGISTER_DISPATCH(cat_serial_stub, &cat_serial_kernel);
6767

68-
}} // at::native
68+
} // at::native

aten/src/ATen/native/cpu/ChannelShuffleKernel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <ATen/cpu/vec/vec.h>
99
#include <c10/util/irange.h>
1010

11-
namespace at { namespace native {
11+
namespace at::native {
1212

1313
namespace {
1414

@@ -113,4 +113,4 @@ void channel_shuffle_kernel_impl(
113113

114114
REGISTER_DISPATCH(channel_shuffle_kernel, &channel_shuffle_kernel_impl);
115115

116-
}} // at::native
116+
} // at::native

aten/src/ATen/native/cpu/ComplexKernel.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
#include <ATen/native/TensorIterator.h>
55
#include <ATen/native/cpu/Loops.h>
66

7-
namespace at {
8-
namespace native {
7+
namespace at::native {
98
namespace {
109

1110
void complex_kernel(TensorIterator& iter) {
@@ -29,5 +28,4 @@ void polar_kernel(TensorIterator& iter) {
2928
REGISTER_DISPATCH(complex_stub, &complex_kernel);
3029
REGISTER_DISPATCH(polar_stub, &polar_kernel);
3130

32-
} // namespace native
33-
} // namespace at
31+
} // namespace at::native

aten/src/ATen/native/cpu/CopyKernel.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
#include <ATen/TensorIteratorInternal.h>
99
#include <ATen/Parallel.h>
1010

11-
namespace at {
12-
namespace native {
11+
namespace at::native {
1312
inline namespace CPU_CAPABILITY {
1413
void neg_kernel(TensorIteratorBase &iter);
1514
void conj_kernel(TensorIteratorBase &iter);
@@ -271,5 +270,4 @@ void copy_kernel(TensorIterator& iter, bool /*non_blocking*/) {
271270

272271
REGISTER_DISPATCH(copy_stub, &copy_kernel);
273272

274-
} // namespace native
275-
} // namespace at
273+
} // namespace at::native

aten/src/ATen/native/cpu/CrossKernel.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
#include <ATen/Parallel.h>
1212
#include <ATen/TensorIterator.h>
1313
#include <c10/util/irange.h>
14-
namespace at { namespace native { namespace {
14+
namespace at::native {
15+
namespace {
1516

1617
template<typename scalar_t>
1718
static void apply_cross(const Tensor& result, const Tensor& a, const Tensor& b, const int64_t dim) {
@@ -77,4 +78,4 @@ static void cross_kernel_impl(const Tensor& result, const Tensor& a, const Tenso
7778

7879
REGISTER_DISPATCH(cross_stub, &cross_kernel_impl);
7980

80-
}} // namespace at::native
81+
} // namespace at::native

aten/src/ATen/native/cpu/DepthwiseConvKernel.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
#include <arm_neon.h>
1616
#endif
1717

18-
namespace at {
19-
namespace native {
18+
namespace at::native {
2019
namespace {
2120

2221
struct Arguments final {
@@ -313,5 +312,4 @@ Tensor _convolution_depthwise3x3_winograd(
313312

314313
REGISTER_DISPATCH(convolution_depthwise3x3_winograd_stub, &_convolution_depthwise3x3_winograd);
315314

316-
} // namespace native
317-
} // namespace at
315+
} // namespace at::native

aten/src/ATen/native/cpu/DistanceOpsKernel.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
#include <ATen/cpu/vec/functional.h>
1111
#include <c10/util/irange.h>
1212

13-
namespace at { namespace native { namespace {
13+
namespace at::native {
14+
namespace {
1415

1516
template<typename scalar_t>
1617
struct Dist {
@@ -447,4 +448,4 @@ REGISTER_DISPATCH(pdist_backward_stub, &pdist_backward_kernel_impl);
447448
REGISTER_DISPATCH(cdist_stub, &cdist_kernel_impl);
448449
REGISTER_DISPATCH(cdist_backward_stub, &cdist_backward_kernel_impl);
449450

450-
}} // namespace at::native
451+
} // namespace at::native

aten/src/ATen/native/cpu/DistributionKernels.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <cpuinfo.h>
2424
#endif
2525

26-
namespace at { namespace native {
26+
namespace at::native {
2727
namespace {
2828

2929
static void cauchy_kernel(TensorIteratorBase& iter, double median, double sigma, c10::optional<Generator> gen) {
@@ -237,5 +237,4 @@ REGISTER_DISPATCH(random_from_to_stub, &random_from_to_kernel);
237237
REGISTER_DISPATCH(random_full_64_bits_range_stub, &random_full_64_bits_range_kernel);
238238
REGISTER_DISPATCH(random_stub, &random_kernel);
239239

240-
} // namespace native
241-
} // namespace at
240+
} // namespace at::native

aten/src/ATen/native/cpu/FillKernel.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <ATen/native/Fill.h>
1010
#include <c10/core/Scalar.h>
1111

12-
namespace at { namespace native {
12+
namespace at::native {
1313
namespace {
1414

1515

@@ -58,5 +58,4 @@ void fill_kernel(TensorIterator& iter, const Scalar& value_scalar) {
5858

5959
REGISTER_DISPATCH(fill_stub, &fill_kernel);
6060

61-
} // namespace native
62-
} // namespace at
61+
} // namespace at::native

aten/src/ATen/native/cpu/FunctionOfAMatrixUtilsKernel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define RESTRICT __restrict__
1212
#endif
1313

14-
namespace at { namespace native {
14+
namespace at::native {
1515

1616
namespace {
1717

@@ -54,4 +54,4 @@ void _compute_linear_combination_cpu_kernel(
5454

5555
REGISTER_DISPATCH(_compute_linear_combination_stub, &_compute_linear_combination_cpu_kernel);
5656

57-
}} // namespace at::native
57+
} // namespace at::native

aten/src/ATen/native/cpu/GridSamplerKernel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <cstring>
1515
#include <type_traits>
1616

17-
namespace at { namespace native { namespace {
17+
namespace at::native { namespace {
1818

1919
/** NOTE [ Grid Sample CPU Kernels ]
2020
*
@@ -1319,4 +1319,4 @@ REGISTER_DISPATCH(grid_sampler_2d_cpu_kernel, &grid_sampler_2d_cpu_kernel_impl);
13191319
REGISTER_DISPATCH(grid_sampler_2d_backward_cpu_kernel, &grid_sampler_2d_backward_cpu_kernel_impl);
13201320

13211321

1322-
}} // namespace at::native
1322+
} // namespace at::native

aten/src/ATen/native/cpu/HistogramKernel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <numeric>
2020
#include <functional>
2121

22-
namespace at { namespace native {
22+
namespace at::native {
2323

2424
namespace {
2525

@@ -288,4 +288,4 @@ REGISTER_DISPATCH(histogramdd_stub, &histogramdd_kernel_impl);
288288

289289
REGISTER_DISPATCH(histogramdd_linear_stub, &histogramdd_linear_kernel_impl);
290290

291-
}} // namespace at::native
291+
} // namespace at::native

aten/src/ATen/native/cpu/IndexKernel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <c10/util/irange.h>
1616
#include <c10/core/Scalar.h>
1717

18-
namespace at { namespace native {
18+
namespace at::native {
1919
namespace {
2020

2121
using namespace vec;
@@ -584,4 +584,4 @@ REGISTER_DISPATCH(masked_select_stub, &masked_select_kernel);
584584
REGISTER_DISPATCH(masked_scatter_stub, &masked_scatter_kernel);
585585
REGISTER_DISPATCH(flip_stub, &flip_kernel);
586586

587-
}} // namespace at::native
587+
} // namespace at::native

aten/src/ATen/native/cpu/LinearAlgebraKernel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <ATen/native/cpu/Loops.h>
99
#include <c10/util/irange.h>
1010

11-
namespace at { namespace native { namespace {
11+
namespace at::native { namespace {
1212

1313
void addr_kernel(TensorIterator &iter,
1414
const Scalar& beta, const Scalar& alpha) {
@@ -86,4 +86,4 @@ void addr_kernel(TensorIterator &iter,
8686
} // anonymous namespace
8787

8888
REGISTER_DISPATCH(addr_stub, &addr_kernel);
89-
}} // namespace at::native
89+
} // namespace at::native

aten/src/ATen/native/cpu/MaxPoolKernel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <ATen/native/cpu/utils.h>
1010
#include <c10/util/irange.h>
1111

12-
namespace at { namespace native {
12+
namespace at::native {
1313

1414
namespace {
1515

@@ -508,4 +508,4 @@ void max_pool2d_backward_kernel_impl(
508508
REGISTER_DISPATCH(max_pool2d_kernel, &max_pool2d_kernel_impl);
509509
REGISTER_DISPATCH(max_pool2d_backward_kernel, &max_pool2d_backward_kernel_impl);
510510

511-
}} // at::native
511+
} // at::native

aten/src/ATen/native/cpu/MaxPooling.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
#include <ATen/native/MaxPooling.h>
77
#include <c10/util/irange.h>
88

9-
namespace at {
10-
namespace native {
9+
namespace at::native {
1110

1211
namespace {
1312

@@ -57,5 +56,4 @@ void max_pool1d_impl(
5756

5857
REGISTER_DISPATCH(max_pool1d_stub, &max_pool1d_impl);
5958

60-
} // namespace native
61-
} // namespace at
59+
} // namespace at::native

aten/src/ATen/native/cpu/MaxUnpoolKernel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include <c10/util/Optional.h>
1111

12-
namespace at { namespace native {
12+
namespace at::native {
1313

1414
namespace {
1515

@@ -269,4 +269,4 @@ void max_unpool3d_kernel_impl(
269269
REGISTER_DISPATCH(max_unpool2d_kernel, &max_unpool2d_kernel_impl);
270270
REGISTER_DISPATCH(max_unpool3d_kernel, &max_unpool3d_kernel_impl);
271271

272-
}} // at::native
272+
} // at::native

0 commit comments

Comments
 (0)