Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static Analysis corrections on DeformConv #2885

Merged
merged 2 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions torchvision/csrc/cpu/DeformConv_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@
#include <iostream>
#include <tuple>

using namespace at;

const int kMaxParallelImgs = 32;

template <typename scalar_t>
Expand Down Expand Up @@ -597,7 +595,7 @@ static void deformable_col2im_coord_kernel(
out_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;
for (int col_c = (offset_c / 2); col_c < c_bound; col_c += col_step) {
Expand Down Expand Up @@ -812,9 +810,9 @@ static std::tuple<at::Tensor, at::Tensor> deform_conv2d_backward_input_cpu(

static at::Tensor deform_conv2d_backward_parameters_cpu(
at::Tensor input,
at::Tensor weight,
const at::Tensor& weight,
at::Tensor offset,
at::Tensor grad_out,
const at::Tensor& grad_out,
std::pair<int, int> stride,
std::pair<int, int> pad,
std::pair<int, int> dilation,
Expand Down
8 changes: 3 additions & 5 deletions torchvision/csrc/cuda/DeformConv_cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@
#include <iostream>
#include <tuple>

using namespace at;

const unsigned int CUDA_NUM_THREADS = 1024;
const int kMaxParallelImgs = 32;

Expand Down Expand Up @@ -618,7 +616,7 @@ __global__ void deformable_col2im_coord_gpu_kernel(
out_h * out_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;
for (int col_c = (offset_c / 2); col_c < c_bound; col_c += col_step) {
Expand Down Expand Up @@ -840,9 +838,9 @@ static std::tuple<at::Tensor, at::Tensor> deform_conv_backward_input_cuda(

static at::Tensor deform_conv_backward_parameters_cuda(
at::Tensor input,
at::Tensor weight,
const at::Tensor& weight,
at::Tensor offset,
at::Tensor grad_out,
const at::Tensor& grad_out,
std::pair<int, int> stride,
std::pair<int, int> pad,
std::pair<int, int> dilation,
Expand Down