Skip to content

Commit 4904b9d

Browse files
generatedunixname89002005287564facebook-github-bot
authored andcommitted
[Codemod][CppQualityCommon] Fix CQS signal performance-unnecessary-value-param in fbcode/pytorch/vision/torchvision/csrc/ops/autograd [B]
Reviewed By: dtolnay Differential Revision: D75049042 fbshipit-source-id: 7a2082c876564a877e1187b42dbc739d62e3697f
1 parent 8235835 commit 4904b9d

File tree

3 files changed

+30
-24
lines changed

3 files changed

+30
-24
lines changed

torchvision/csrc/ops/autograd/ps_roi_pool_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

@@ -15,8 +17,8 @@ class PSROIPoolFunction : public torch::autograd::Function<PSROIPoolFunction> {
1517
const torch::autograd::Variable& input,
1618
const torch::autograd::Variable& rois,
1719
double spatial_scale,
18-
c10::SymInt pooled_height,
19-
c10::SymInt pooled_width) {
20+
const c10::SymInt& pooled_height,
21+
const c10::SymInt& pooled_width) {
2022
ctx->saved_data["spatial_scale"] = spatial_scale;
2123
ctx->saved_data["pooled_height"] = pooled_height;
2224
ctx->saved_data["pooled_width"] = pooled_width;
@@ -84,12 +86,12 @@ class PSROIPoolBackwardFunction
8486
rois,
8587
channel_mapping,
8688
spatial_scale,
87-
pooled_height,
88-
pooled_width,
89-
batch_size,
90-
channels,
91-
height,
92-
width);
89+
std::move(pooled_height),
90+
std::move(pooled_width),
91+
std::move(batch_size),
92+
std::move(channels),
93+
std::move(height),
94+
std::move(width));
9395

9496
return {grad_in};
9597
}

torchvision/csrc/ops/autograd/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

@@ -15,8 +17,8 @@ class ROIAlignFunction : public torch::autograd::Function<ROIAlignFunction> {
1517
const torch::autograd::Variable& input,
1618
const torch::autograd::Variable& rois,
1719
double spatial_scale,
18-
c10::SymInt pooled_height,
19-
c10::SymInt pooled_width,
20+
const c10::SymInt& pooled_height,
21+
const c10::SymInt& pooled_width,
2022
int64_t sampling_ratio,
2123
bool aligned) {
2224
ctx->saved_data["spatial_scale"] = spatial_scale;
@@ -90,12 +92,12 @@ class ROIAlignBackwardFunction
9092
grad,
9193
rois,
9294
spatial_scale,
93-
pooled_height,
94-
pooled_width,
95-
batch_size,
96-
channels,
97-
height,
98-
width,
95+
std::move(pooled_height),
96+
std::move(pooled_width),
97+
std::move(batch_size),
98+
std::move(channels),
99+
std::move(height),
100+
std::move(width),
99101
sampling_ratio,
100102
aligned);
101103
return {result};

torchvision/csrc/ops/autograd/roi_pool_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

@@ -15,8 +17,8 @@ class ROIPoolFunction : public torch::autograd::Function<ROIPoolFunction> {
1517
const torch::autograd::Variable& input,
1618
const torch::autograd::Variable& rois,
1719
double spatial_scale,
18-
c10::SymInt pooled_height,
19-
c10::SymInt pooled_width) {
20+
const c10::SymInt& pooled_height,
21+
const c10::SymInt& pooled_width) {
2022
ctx->saved_data["spatial_scale"] = spatial_scale;
2123
ctx->saved_data["pooled_height"] = pooled_height;
2224
ctx->saved_data["pooled_width"] = pooled_width;
@@ -84,12 +86,12 @@ class ROIPoolBackwardFunction
8486
rois,
8587
argmax,
8688
spatial_scale,
87-
pooled_height,
88-
pooled_width,
89-
batch_size,
90-
channels,
91-
height,
92-
width);
89+
std::move(pooled_height),
90+
std::move(pooled_width),
91+
std::move(batch_size),
92+
std::move(channels),
93+
std::move(height),
94+
std::move(width));
9395

9496
return {grad_in};
9597
}

0 commit comments

Comments
 (0)