Skip to content

Commit 1d15ac1

Browse files
committed
Replace abs by std::abs in DeformConv_cuda
1 parent c7c09ca commit 1d15ac1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

torchvision/csrc/cuda/DeformConv_cuda.cu

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@
7474

7575
#include "cuda_helpers.h"
7676

77+
#include <cmath>
7778
#include <iostream>
79+
#include <tuple>
7880

7981
using namespace at;
8082

@@ -470,9 +472,9 @@ __global__ void deformable_col2im_gpu_kernel(
470472
int yp = int(y) + dy;
471473
int xp = int(x) + dx;
472474
if (0 <= yp && yp < height && 0 <= xp && xp < width &&
473-
abs(y - yp) < 1 && abs(x - xp) < 1) {
475+
std::abs(y - yp) < 1 && std::abs(x - xp) < 1) {
474476
int grad_pos = ((b * channels + c) * height + yp) * width + xp;
475-
scalar_t weight = (1 - abs(y - yp)) * (1 - abs(x - xp));
477+
scalar_t weight = (1 - std::abs(y - yp)) * (1 - std::abs(x - xp));
476478
atomicAdd(grad_im + grad_pos, weight * col[index]);
477479
}
478480
}

0 commit comments

Comments
 (0)