Check that dimension to be sorted is contiguous when using Thrust.
diff --git a/THCTensorSort.cu b/THCTensorSort.cu
index 84b8c6d..1bc3826 100644
--- a/THCTensorSort.cu
+++ b/THCTensorSort.cu
@@ -377,6 +377,9 @@
long sliceStride = THCudaTensor_stride(state, input, dim);
long numSlices = totalElements / sliceSize;
+ THArgCheck(THCudaTensor_stride(state, input, dim) == 1, 1,
+ "The dimension to be sorted must be contiguous.");
+
// Copy input to sorted, since we sort in place
if (sorted != input) {
THCudaTensor_copy(state, sorted, input);