File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1118,7 +1118,7 @@ int GpuArray_is_c_contiguous(const GpuArray *a) {
11181118 int i ;
11191119
11201120 for (i = a -> nd - 1 ; i >= 0 ; i -- ) {
1121- if (a -> strides [i ] != (ssize_t )size ) return 0 ;
1121+ if (a -> strides [i ] != (ssize_t )size && a -> dimensions [ i ] != 1 ) return 0 ;
11221122 // We suppose that overflow will not happen since data has to fit in memory
11231123 size *= a -> dimensions [i ];
11241124 }
@@ -1130,7 +1130,7 @@ int GpuArray_is_f_contiguous(const GpuArray *a) {
11301130 unsigned int i ;
11311131
11321132 for (i = 0 ; i < a -> nd ; i ++ ) {
1133- if (a -> strides [i ] != (ssize_t )size ) return 0 ;
1133+ if (a -> strides [i ] != (ssize_t )size && a -> dimensions [ i ] != 1 ) return 0 ;
11341134 // We suppose that overflow will not happen since data has to fit in memory
11351135 size *= a -> dimensions [i ];
11361136 }
You can’t perform that action at this time.
0 commit comments