8000 Enable clang-tidy in torch/csrc/quantized and some fixes (#113604) · pytorch/pytorch@79e3833 · GitHub
[go: up one dir, main page]

Skip to content

Commit 79e3833

Browse files
cyyeverpytorchmergebot
authored andcommitted
Enable clang-tidy in torch/csrc/quantized and some fixes (#113604)
This PR enables clang-tidy checks in torch/csrc/quantized/ Pull Request resolved: #113604 Approved by: https://github.com/Skylion007
1 parent 14eb92c commit 79e3833

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

.lintrunner.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ exclude_patterns = [
267267
'torch/csrc/jit/serialization/export.cpp',
268268
'torch/csrc/lazy/**/*',
269269
'torch/csrc/onnx/init.cpp',
270-
'torch/csrc/quantized/**/*',
271270
'torch/csrc/mps/**/*',
272271
]
273272
init_command = [

torch/csrc/quantized/quantized_backward.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,19 @@ class PackedLinearWeightDynamicBackward
3030
c10::detail::intrusive_target_default_null_type<
3131
LinearPackedParamsBase>> const&,
3232
bool)>();
33-
auto output = op.redispatch(
34-
DispatchKeySet({DispatchKey::CPU}), input, packed_weight, reduce_range);
35-
auto input_contig = input.contiguous();
3633
// Calculate statistics for quantization of input Tensor
3734
float x_min = 0;
3835
float x_max = 0;
3936
if (input.numel() > 0) {
37+
auto input_contig = input.contiguous();
4038
x_min = input_contig.min().item<float>();
4139
x_max = input_contig.max().item<float>();
4240
}
41+
auto output = op.redispatch(
42+
DispatchKeySet({DispatchKey::CPU}),
43+
std::move(input),
44+
packed_weight,
45+
reduce_range);
4346
auto q_params = quant_utils::ChooseQuantizationParams(
4447
/*min=*/x_min,
4548
/*max=*/x_max,
@@ -147,7 +150,7 @@ at::Tensor packed_linear_weight_grad(
147150
const c10::intrusive_ptr<LinearPackedParamsBase>& packed_weight,
148151
bool reduce_range) {
149152
return PackedLinearWeightDynamicBackward::apply(
150-
input, packed_weight, reduce_range);
153+
std::move(input), packed_weight, reduce_range);
151154
}
152155
} // namespace
153156

0 commit comments

Comments
 (0)
0