This should work:
CUDAStream stream = getCurrentCUDAStream(); AT_CUDA_CHECK(cudaStreamSynchronize(stream));