Skip to content

Commit 869d1ad

Browse files
malfetpytorchmergebot
authored andcommitted
[BE] Nested namespace in quantized folder (pytorch#139166)
Fixes #ISSUE_NUMBER Pull Request resolved: pytorch#139166 Approved by: https://github.com/cyyever, https://github.com/Skylion007
1 parent 489c66f commit 869d1ad

Some content is hidden

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

59 files changed

+116
-235
lines changed

aten/src/ATen/native/quantized/cpu/AdaptiveAveragePooling.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424

2525
#include <ATen/native/quantized/cpu/QnnpackUtils.h>
2626

27-
namespace at {
28-
namespace native {
27+
namespace at::native {
2928

3029
DEFINE_DISPATCH(qadaptive_avg_pool2d_nhwc_stub);
3130
DEFINE_DISPATCH(qadaptive_avg_pool3d_ndhwc_stub);
@@ -352,5 +351,4 @@ Tensor adaptive_avg_pool3d_quantized_cpu(
352351
return at::native::adaptive_avg_pool3d_out_quantized_cpu(input, output_size, output);
353352
}
354353

355-
} // namespace native
356-
} // namespace at
354+
} // namespace at::native

aten/src/ATen/native/quantized/cpu/AveragePool2d.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
#include <limits>
2525
#include <vector>
2626

27-
namespace at {
28-
namespace native {
27+
namespace at::native {
2928

3029
DEFINE_DISPATCH(qavg_pool2d_nhwc_stub);
3130

@@ -390,5 +389,4 @@ Tensor avg_pool2d_quantized_cpu(
390389
return output;
391390
}
392391

393-
} // namespace native
394-
} // namespace at
392+
} // namespace at::native

aten/src/ATen/native/quantized/cpu/AveragePool3d.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717
#include <vector>
1818

19-
namespace at {
20-
namespace native {
19+
namespace at::native {
2120

2221
DEFINE_DISPATCH(qavg_pool3d_nhwc_stub);
2322

@@ -180,5 +179,4 @@ Tensor avg_pool3d_quantized_cpu(
180179
return output;
181180
}
182181

183-
} // namespace native
184-
} // namespace at
182+
} // namespace at::native

aten/src/ATen/native/quantized/cpu/BinaryOps.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
#include <algorithm>
2626
#include <utility>
2727

28-
namespace at {
29-
namespace native {
28+
namespace at::native {
3029

3130
DEFINE_DISPATCH(qadd_relu_stub);
3231
DEFINE_DISPATCH(qadd_stub);
@@ -505,4 +504,4 @@ Tensor quantized_add(Tensor qa, Tensor qb, double scale, int64_t zero_point){
505504
return qadd<false>(std::move(qa), std::move(qb), scale, zero_point);
506505
}
507506

508-
}} // namespace at::native
507+
} // namespace at::native
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#include <ATen/core/Tensor.h>
22

3-
namespace at {
4-
namespace native {
3+
namespace at::native {
54
TORCH_API Tensor
65
quantized_add(Tensor qa, Tensor qb, double scale, int64_t zero_point);
7-
}
8-
} // namespace at
6+
} // namespace at::native

aten/src/ATen/native/quantized/cpu/ChannelShuffle.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
#include <ATen/ops/channel_shuffle_native.h>
1313
#endif
1414

15-
namespace at {
16-
namespace native {
15+
namespace at::native {
1716

1817
#ifdef USE_PYTORCH_QNNPACK
1918
namespace {
@@ -120,5 +119,4 @@ class QChannelShuffle final : public c10::OperatorKernel {
120119

121120
} // namespace
122121

123-
} // namespace native
124-
} // namespace at
122+
} // namespace at::native

aten/src/ATen/native/quantized/cpu/IntReprQuant.cpp

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

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

2120
// When input Tensor is non-dense, i.e. the allocated memory
2221
// is larger than the memory used by all the elements, we'll
@@ -52,5 +51,4 @@ Tensor int_repr_quantized_cpu(const Tensor& self) {
5251
return dst;
5352
}
5453

55-
} // namespace native
56-
} // namespace at
54+
} // namespace at::native

aten/src/ATen/native/quantized/cpu/MakePerTensorQuantizedTensor.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
#include <ATen/ops/_make_per_tensor_quantized_tensor_native.h>
1212
#endif
1313

14-
namespace at {
15-
namespace native {
14+
namespace at::native {
1615

1716
Tensor make_per_tensor_quantized_tensor_cpu(
1817
const Tensor& self,
@@ -37,5 +36,4 @@ Tensor make_per_tensor_quantized_tensor_cpu(
3736
return dst;
3837
}
3938

40-
} // namespace native
41-
} // namespace at
39+
} // namespace at::native

aten/src/ATen/native/quantized/cpu/Normalization.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717
#include <algorithm>
1818

19-
namespace at {
20-
namespace native {
19+
namespace at::native {
2120

2221
DEFINE_DISPATCH(qbatch_norm_stub);
2322
DEFINE_DISPATCH(qbatch_norm_relu_stub);
@@ -412,5 +411,4 @@ TORCH_LIBRARY_IMPL(quantized, QuantizedCPU, m) {
412411
m.impl(TORCH_SELECTIVE_NAME("quantized::batch_norm3d_relu"), TORCH_FN(q_batch_norm3d_impl<true>));
413412
}
414413

415-
} // namespace native
416-
} // namespace at
414+
} // namespace at::native

aten/src/ATen/native/quantized/cpu/Pooling.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
#include <algorithm>
3030
#include <vector>
3131

32-
namespace at {
33-
namespace native {
32+
namespace at::native {
3433

3534
DEFINE_DISPATCH(qmaxpool_2d_nhwc_stub);
3635
DEFINE_DISPATCH(qmaxpool_3d_nthwc_stub);
@@ -763,5 +762,4 @@ TORCH_LIBRARY_IMPL(quantized, CPU, m) {
763762
}
764763

765764
} // namespace
766-
} // namespace native
767-
} // namespace at
765+
} // namespace at::native

aten/src/ATen/native/quantized/cpu/QnnpackUtils.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,7 @@ inline std::pair<T, T> activationLimits(
428428
}
429429
}
430430

431-
namespace at {
432-
namespace native {
433-
namespace qnnp_avgpool_helper {
431+
namespace at::native::qnnp_avgpool_helper {
434432
Tensor qnnpack_avg_pool2d(
435433
Tensor input,
436434
IntArrayRef kernel_size,
@@ -439,9 +437,7 @@ Tensor qnnpack_avg_pool2d(
439437
bool ceil_mode,
440438
bool count_include_pad,
441439
std::optional<int64_t> divisor_override);
442-
} // qnnp_avgpool_helper
443-
} // namespace native
444-
} // namespace at
440+
} // namespace at::native::qnnp_avgpool_helper
445441

446442
namespace {
447443
[[maybe_unused]] std::vector<float> generate_requantization_scales(

aten/src/ATen/native/quantized/cpu/QuantizedOps.h

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

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

1211
using qrelu_fn = void (*)(const at::Tensor& /*qx*/, at::Tensor& /*qy*/);
1312
using qrelu_leaky_fn = void (*)(Tensor& /*out*/, const Tensor& /*qx*/,
@@ -254,5 +253,4 @@ DECLARE_DISPATCH(qmean_inner_dim_fn, qmean_inner_dim_stub);
254253
DECLARE_DISPATCH(qstd_inner_dim_fn, qstd_inner_dim_stub);
255254
DECLARE_DISPATCH(qprelu_fn, qprelu_stub);
256255

257-
} // namespace native
258-
} // namespace at
256+
} // namespace at::native

aten/src/ATen/native/quantized/cpu/ReduceOps.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
#include <ATen/ops/zeros_like_ops.h>
2121
#endif
2222

23-
namespace at {
24-
namespace native {
23+
namespace at::native {
2524

2625
DEFINE_DISPATCH(qmean_inner_dim_stub);
2726
DEFINE_DISPATCH(qstd_inner_dim_stub);
@@ -227,5 +226,4 @@ Tensor std_quantized_cpu(
227226
return result;
228227
}
229228

230-
} // namespace native
231-
} // namespace at
229+
} // namespace at::native

aten/src/ATen/native/quantized/cpu/RuyUtils.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
#include <ATen/ATen.h>
44
#include <ATen/native/quantized/cpu/RuyUtils.h>
55

6-
namespace at {
7-
namespace native {
8-
namespace ruy_utils {
6+
namespace at::native::ruy_utils {
97

108
static thread_local ruy::Context context;
119

@@ -30,8 +28,6 @@ void quantize_multiplier(double scale,
3028
*multiplier_fixedpoint = static_cast<std::int32_t>(q_fixed);
3129
}
3230

33-
} // namespace ruy_utils
34-
} // namespace native
35-
} // namespace
31+
} // namespace at::native::ruy_utils
3632

3733
#endif // USE_RUY_QMATMUL

aten/src/ATen/native/quantized/cpu/RuyUtils.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,14 @@
44

55
#include <ruy/ruy.h>
66

7-
namespace at {
8-
namespace native {
9-
namespace ruy_utils {
7+
namespace at::native::ruy_utils {
108

119
ruy::Context* get_ruy_context();
1210

1311
void quantize_multiplier(double scale,
1412
int* multiplier_fixedpoint,
1513
int* multiplier_exponent);
1614

17-
} // namespace ruy_utils
18-
} // namespace native
19-
} // namespace
15+
} // namespace at::native::ruy_utils
2016

2117
#endif // USE_RUY_QMATMUL

aten/src/ATen/native/quantized/cpu/Sorting.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
#include <ATen/ops/topk_native.h>
1414
#endif
1515

16-
namespace at {
17-
namespace native {
16+
namespace at::native {
1817

1918
// Currently internal-only.
2019
//
@@ -64,4 +63,4 @@ std::tuple<Tensor, Tensor> topk_quantized_cpu(
6463

6564
DEFINE_DISPATCH(qtopk_stub);
6665

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

aten/src/ATen/native/quantized/cpu/TensorOperators.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
#include <ATen/ops/resize_native.h>
2525
#endif
2626

27-
namespace at {
28-
namespace native {
27+
namespace at::native {
2928

3029
/*
3130
All comparator operators will be named "<aten op name>_quantized_cpu".
@@ -100,4 +99,4 @@ const Tensor& quantized_resize_cpu_(
10099
return self;
101100
}
102101

103-
}} // at::native
102+
} // namespace at::native

aten/src/ATen/native/quantized/cpu/UpSampleBilinear2d.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818

1919
#include <cstring>
2020

21-
namespace at {
22-
namespace native {
21+
namespace at::native {
2322
namespace {
2423

2524
// pre calculate interpolation params on width
@@ -217,5 +216,4 @@ Tensor upsample_bilinear2d_quantized_cpu(
217216
}
218217

219218
DEFINE_DISPATCH(qupsample_bilinear2d_nhwc_stub);
220-
} // namespace native
221-
} // namespace at
219+
} // namespace at::native

aten/src/ATen/native/quantized/cpu/UpSampleNearest2d.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
#include <cstring>
2020

2121

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

2524
// Define a typedef to dispatch to nearest_idx or nearest_exact_idx
2625
typedef int64_t (*nn_compute_source_index_fn_t)(const float, int64_t, int64_t);
@@ -218,5 +217,4 @@ Tensor _upsample_nearest_exact2d_quantized_cpu(
218217
return _upsample_nearest2d_quantized_cpu<nearest_neighbor_exact_compute_source_index>(input, osize, scale_h, scale_w);
219218
}
220219

221-
} // namespace native
222-
} // namespace at
220+
} // namespace at::native

aten/src/ATen/native/quantized/cpu/UpSampleNearest3d.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
#include <cstring>
1818

1919

20-
namespace at {
21-
namespace native {
20+
namespace at::native {
2221

2322
// Define a typedef to dispatch to nearest_idx or nearest_exact_idx
2423
typedef int64_t (*nn_compute_source_index_fn_t)(const float, int64_t, int64_t);
@@ -234,5 +233,4 @@ Tensor _upsample_nearest_exact3d_quantized_cpu(
234233
input, osize, scale_d, scale_h, scale_w);
235234
}
236235

237-
} // namespace native
238-
} // namespace at
236+
} // namespace at::native

aten/src/ATen/native/quantized/cpu/XnnpackUtils.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
#include <ATen/native/quantized/cpu/XnnpackUtils.h>
66
#include <c10/util/irange.h>
77

8-
namespace at {
9-
namespace native {
10-
namespace xnnp_utils {
8+
namespace at::native::xnnp_utils {
119

1210
std::vector<size_t> get_mem_format_aware_shape(const at::Tensor& in) {
1311
const auto mem_format = in.suggest_memory_format();
@@ -82,8 +80,6 @@ Tensor convert_conv_weights_to_channel_last_tensor<2>(
8280
// 2d conv weight transform
8381
: src.contiguous(c10::MemoryFormat::ChannelsLast);
8482
}
85-
} // namespace xnnp_utils
86-
} // namespace native
87-
} // namespace at
83+
} // namespace at::native::xnnp_utils
8884

8985
#endif // USE_XNNPACK

aten/src/ATen/native/quantized/cpu/XnnpackUtils.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99
using xnnpack_operator = at::native::xnnpack::Operator;
1010

11-
namespace at {
12-
namespace native {
13-
namespace xnnp_utils {
11+
namespace at::native::xnnp_utils {
1412

1513
/*
1614
* Return shape in the same order as the memory format
@@ -328,8 +326,6 @@ enum xnn_status xnnp_setup_fully_connected_nc(
328326
);
329327
}
330328

331-
} // namespace xnnp_utils
332-
} // namespace native
333-
} // namespace at
329+
} // namespace at::native::xnnp_utils
334330

335331
#endif // USE_XNNPACK

0 commit comments

Comments
 (0)