Sense-X/X-Temporal

issues with pytorch version higher than 1.4.0

lininglouis opened this issue · 1 comments

The THCState_getCurrentStream seems deprecated in pytorch 1.5.0 or higher.
I read some information on replacing it with at::cuda::getCurrentCUDAStream, but failed. Any idea on fixing it?

error information below

./X-Temporal/x_temporal/cuda_shift/src/shift_cuda.cpp: In function ‘at::Tensor shift_featuremap_cuda_backward(const at::Tensor&, const at::Tensor&, const at::Tensor&)’:
./X-Temporal/x_temporal/cuda_shift/src/shift_cuda.cpp:41:27: error: ‘THCState_getCurrentStream’ was not declared in this scope
     ShiftDataCudaBackward(THCState_getCurrentStream(state),
                           ^~~~~~~~~~~~~~~~~~~~~~~~~

fix by replacement in "X-Temporal/x_temporal/cuda_shift/src/shift_cuda.cpp"

before

    ShiftDataCudaForward(THCState_getCurrentStream(),
                        data.data<float>(),
                        shift.data<int>(),
                        batch_size,
                        channels,
                        tsize,
                        hwsize,
                        groupsize,
                        out.data<float>());

after

    ShiftDataCudaForward(at::cuda::getCurrentCUDAStream(),
                        data.data<float>(),
                        shift.data<int>(),
                        batch_size,
                        channels,
                        tsize,
                        hwsize,
                        groupsize,
                        out.data<float>());