Skip to content

Commit 333d0ef

Browse files
generatedunixname89002005287564facebook-github-bot
authored andcommitted
[Codemod][CppQualityCommon] Fix CQS signal performance-unnecessary-value-param in fbcode/pytorch/vision/torchvision/csrc/ops/autograd [A]
Reviewed By: dtolnay Differential Revision: D75048922 fbshipit-source-id: 497744839b64dbb37b9c5fcb6a6df326154b3c1d
1 parent 4904b9d commit 333d0ef

File tree

2 files changed

+28
-24
lines changed

2 files changed

+28
-24
lines changed

torchvision/csrc/ops/autograd/deform_conv2d_kernel.cpp

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include <torch/autograd.h>
44
#include <torch/types.h>
55

6+
#include <utility>
7+
68
namespace vision {
79
namespace ops {
810

@@ -18,14 +20,14 @@ class DeformConv2dFunction
1820
const torch::autograd::Variable& offset,
1921
const torch::autograd::Variable& mask,
2022
const torch::autograd::Variable& bias,
21-
c10::SymInt stride_h,
22-
c10::SymInt stride_w,
23-
c10::SymInt pad_h,
24-
c10::SymInt pad_w,
25-
c10::SymInt dilation_h,
26-
c10::SymInt dilation_w,
27-
c10::SymInt groups,
28-
c10::SymInt offset_groups,
23+
const c10::SymInt& stride_h,
24+
const c10::SymInt& stride_w,
25+
const c10::SymInt& pad_h,
26+
const c10::SymInt& pad_w,
27+
const c10::SymInt& dilation_h,
28+
const c10::SymInt& dilation_w,
29+
const c10::SymInt& groups,
30+
const c10::SymInt& offset_groups,
2931
bool use_mask) {
3032
at::AutoDispatchBelowADInplaceOrView g;
3133
auto output = deform_conv2d_symint(
@@ -150,14 +152,14 @@ class DeformConv2dBackwardFunction
150152
offset,
151153
mask,
152154
bias,
153-
stride_h,
154-
stride_w,
155-
pad_h,
156-
pad_w,
157-
dilation_h,
158-
dilation_w,
159-
groups,
160-
offset_groups,
155+
std::move(stride_h),
156+
std::move(stride_w),
157+
std::move(pad_h),
158+
std::move(pad_w),
159+
std::move(dilation_h),
160+
std::move(dilation_w),
161+
std::move(groups),
162+
std::move(offset_groups),
161163
use_mask);
162164

163165
auto grad_input = std::get<0>(result);

torchvision/csrc/ops/autograd/ps_roi_align_kernel.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include <torch/autograd.h>
44
#include <torch/types.h>
55

6+
#include <utility>
7+
68
namespace vision {
79
namespace ops {
810

@@ -16,8 +18,8 @@ class PSROIAlignFunction
1618
const torch::autograd::Variable& input,
1719
const torch::autograd::Variable& rois,
1820
double spatial_scale,
19-
c10::SymInt pooled_height,
20-
c10::SymInt pooled_width,
21+
const c10::SymInt& pooled_height,
22+
const c10::SymInt& pooled_width,
2123
int64_t sampling_ratio) {
2224
ctx->saved_data["spatial_scale"] = spatial_scale;
2325
ctx->saved_data["pooled_height"] = pooled_height;
@@ -95,13 +97,13 @@ class PSROIAlignBackwardFunction
9597
rois,
9698
channel_mapping,
9799
spatial_scale,
98-
pooled_height,
99-
pooled_width,
100+
std::move(pooled_height),
101+
std::move(pooled_width),
100102
sampling_ratio,
101-
batch_size,
102-
channels,
103-
height,
104-
width);
103+
std::move(batch_size),
104+
std::move(channels),
105+
std::move(height),
106+
std::move(width));
105107

106108
return {grad_in};
107109
}

0 commit comments

Comments
 (0)