Skip to content

Commit 4710fd9

Browse files
cyyeverpytorchmergebot
authored andcommitted
Remove unnecessary uses of thrust::pair (pytorch#168941)
This PR replaces unnecessary uses of thrust::pair with std::pair. Pull Request resolved: pytorch#168941 Approved by: https://github.com/albanD
1 parent 3620149 commit 4710fd9

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

aten/src/ATen/native/cuda/ReflectionPad.cu

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@
2323
#include <ATen/ops/reflection_pad3d_backward_native.h>
2424
#endif
2525

26-
#include <thrust/pair.h>
2726

2827
namespace at::native {
2928
namespace {
3029

3130
using at::cuda::detail::canUse32BitIndexMath;
3231

3332
__device__
34-
inline thrust::pair<int64_t, int64_t> get_index_mapping1d(
33+
inline std::pair<int64_t, int64_t> get_index_mapping1d(
3534
int64_t input_w, int64_t output_w,
3635
int64_t output_x,
3736
int64_t pad_l) {
@@ -50,13 +49,13 @@ inline thrust::pair<int64_t, int64_t> get_index_mapping1d(
5049
+ 2 * pad_l + input_w - 1
5150
- o_start_x + i_start_x;
5251

53-
return thrust::make_pair<int64_t, int64_t>(
52+
return std::make_pair<int64_t, int64_t>(
5453
input_offset + input_x, output_offset + output_x);
5554
}
5655

5756

5857
__device__
59-
inline thrust::pair<int64_t, int64_t> get_index_mapping2d(
58+
inline std::pair<int64_t, int64_t> get_index_mapping2d(
6059
int64_t input_dim_x, int64_t input_dim_y,
6160
int64_t output_dim_x, int64_t output_dim_y,
6261
int64_t pad_l, int64_t pad_t,
@@ -87,7 +86,7 @@ inline thrust::pair<int64_t, int64_t> get_index_mapping2d(
8786
+ 2 * pad_t + input_dim_y - 1
8887
- o_start_y + i_start_y;
8988

90-
return thrust::make_pair<int64_t, int64_t>(
89+
return std::make_pair<int64_t, int64_t>(
9190
input_offset + input_y * input_dim_x + input_x,
9291
output_offset + output_y * output_dim_x + output_x);
9392
}

aten/src/ATen/native/cuda/group_norm_kernel.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ __global__ void RowwiseMomentsCUDAKernel(
3838
using T_ACC = acc_type<T, true>;
3939
using WelfordType = WelfordData<T_ACC, int64_t>;
4040
using WelfordOp =
41-
WelfordOps<T_ACC, T_ACC, int64_t, thrust::pair<T_ACC, T_ACC>>;
41+
WelfordOps<T_ACC, T_ACC, int64_t, std::pair<T_ACC, T_ACC>>;
4242

4343
const int64_t i = blockIdx.x;
4444
WelfordOp welford_op = {/*correction=*/0, /*take_sqrt=*/false};

aten/src/ATen/native/cuda/layer_norm_kernel.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ __global__ void RowwiseMomentsCUDAKernel(
6464
T_ACC* rstd) {
6565
using WelfordType = WelfordData<T_ACC, int64_t>;
6666
using WelfordOp =
67-
WelfordOps<T_ACC, T_ACC, int64_t, thrust::pair<T_ACC, T_ACC>>;
67+
WelfordOps<T_ACC, T_ACC, int64_t, std::pair<T_ACC, T_ACC>>;
6868

6969
__shared__
7070
typename std::aligned_storage<sizeof(WelfordType), alignof(WelfordType)>::

aten/src/ATen/native/sparse/cuda/SparseCUDATensor.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ SparseTensor _coalesce_sparse_cuda(const SparseTensor& self) {
8888
);
8989

9090
// this forces device-host synchronization!
91-
thrust::pair<thrust_ptr, thrust_ptr> newEnd = thrust::unique_by_key(policy,
91+
auto newEnd = thrust::unique_by_key(policy,
9292
indicesIter, indicesIter + nnz,
9393
uniqueOffsetsIter
9494
);

0 commit comments

Comments
 (0)