Unverified Commit 5cb77a20 authored by Vasilis Vryniotis's avatar Vasilis Vryniotis Committed by GitHub
Browse files

Static Analysis corrections on DeformConv (#2885)

* Convert to const reference and eliminate unnecessary bool casting.

* Removing unnecessary namespace use.
parent cffac640
...@@ -74,8 +74,6 @@ ...@@ -74,8 +74,6 @@
#include <iostream> #include <iostream>
#include <tuple> #include <tuple>
using namespace at;
const int kMaxParallelImgs = 32; const int kMaxParallelImgs = 32;
template <typename scalar_t> template <typename scalar_t>
...@@ -597,7 +595,7 @@ static void deformable_col2im_coord_kernel( ...@@ -597,7 +595,7 @@ static void deformable_col2im_coord_kernel(
out_w; out_w;
const int offset_c = c - offset_grp * 2 * weight_h * weight_w; const int offset_c = c - offset_grp * 2 * weight_h * weight_w;
const int is_y_direction = offset_c % 2 == 0; const bool is_y_direction = offset_c % 2 == 0;
const int c_bound = c_per_offset_grp * weight_h * weight_w; const int c_bound = c_per_offset_grp * weight_h * weight_w;
for (int col_c = (offset_c / 2); col_c < c_bound; col_c += col_step) { for (int col_c = (offset_c / 2); col_c < c_bound; col_c += col_step) {
...@@ -812,9 +810,9 @@ static std::tuple<at::Tensor, at::Tensor> deform_conv2d_backward_input_cpu( ...@@ -812,9 +810,9 @@ static std::tuple<at::Tensor, at::Tensor> deform_conv2d_backward_input_cpu(
static at::Tensor deform_conv2d_backward_parameters_cpu( static at::Tensor deform_conv2d_backward_parameters_cpu(
at::Tensor input, at::Tensor input,
at::Tensor weight, const at::Tensor& weight,
at::Tensor offset, at::Tensor offset,
at::Tensor grad_out, const at::Tensor& grad_out,
std::pair<int, int> stride, std::pair<int, int> stride,
std::pair<int, int> pad, std::pair<int, int> pad,
std::pair<int, int> dilation, std::pair<int, int> dilation,
......
...@@ -78,8 +78,6 @@ ...@@ -78,8 +78,6 @@
#include <iostream> #include <iostream>
#include <tuple> #include <tuple>
using namespace at;
const unsigned int CUDA_NUM_THREADS = 1024; const unsigned int CUDA_NUM_THREADS = 1024;
const int kMaxParallelImgs = 32; const int kMaxParallelImgs = 32;
...@@ -618,7 +616,7 @@ __global__ void deformable_col2im_coord_gpu_kernel( ...@@ -618,7 +616,7 @@ __global__ void deformable_col2im_coord_gpu_kernel(
out_h * out_w; out_h * out_w;
const int offset_c = c - offset_grp * 2 * weight_h * weight_w; const int offset_c = c - offset_grp * 2 * weight_h * weight_w;
const int is_y_direction = offset_c % 2 == 0; const bool is_y_direction = offset_c % 2 == 0;
const int c_bound = c_per_offset_grp * weight_h * weight_w; const int c_bound = c_per_offset_grp * weight_h * weight_w;
for (int col_c = (offset_c / 2); col_c < c_bound; col_c += col_step) { for (int col_c = (offset_c / 2); col_c < c_bound; col_c += col_step) {
...@@ -840,9 +838,9 @@ static std::tuple<at::Tensor, at::Tensor> deform_conv_backward_input_cuda( ...@@ -840,9 +838,9 @@ static std::tuple<at::Tensor, at::Tensor> deform_conv_backward_input_cuda(
static at::Tensor deform_conv_backward_parameters_cuda( static at::Tensor deform_conv_backward_parameters_cuda(
at::Tensor input, at::Tensor input,
at::Tensor weight, const at::Tensor& weight,
at::Tensor offset, at::Tensor offset,
at::Tensor grad_out, const at::Tensor& grad_out,
std::pair<int, int> stride, std::pair<int, int> stride,
std::pair<int, int> pad, std::pair<int, int> pad,
std::pair<int, int> dilation, std::pair<int, int> dilation,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment