@@ -11,6 +11,8 @@ static inline void THNN_(SpatialConvolutionMM_shapeCheck)(
1111 " kernel size should be greater than zero, but got kH: %d kW: %d" , kH , kW );
1212 THArgCheck (dW > 0 && dH > 0 , 11 ,
1313 " stride should be greater than zero, but got dH: %d dW: %d" , dH, dW);
14+ THArgCheck (!bias || THCTensor_ (isContiguous)(state, bias), 5 ,
15+ " bias tensor has to be contiguous" );
1416 THCUNN_argCheck (state, weight->nDimension == 2 || weight->nDimension == 4 , 5 , weight,
1517 " 2D or 4D weight tensor expected, but got: %s" );
1618
@@ -69,6 +71,9 @@ void THNN_(SpatialConvolutionMM_updateOutput)(
6971 if (bias) {
7072 THCUNN_assertSameGPU (state, 2 , weight, bias);
7173 }
74+ THArgCheck (THCTensor_ (isContiguous)(state, weight), 4 ,
75+ " weight tensor has to be contiguous" );
76+
7277 int freeWeight = 0 ;
7378
7479 // Params:
@@ -217,6 +222,8 @@ void THNN_(SpatialConvolutionMM_updateGradInput)(
217222
218223 THCUNN_assertSameGPU (state, 5 , input, gradOutput, weight,
219224 gradColumns, gradInput);
225+ THArgCheck (THCTensor_ (isContiguous)(state, weight), 4 ,
226+ " weight tensor has to be contiguous" );
220227
221228 // Params
222229 int nInputPlane = weight->nDimension == 2 ? weight->size [1 ]/(kW *kH ) : weight->size [1 ];
@@ -334,6 +341,8 @@ void THNN_(SpatialConvolutionMM_accGradParameters)(
334341 if (gradBias) {
335342 THCUNN_assertSameGPU (state, 2 , gradWeight, gradBias);
336343 }
344+ THArgCheck (THCTensor_ (isContiguous)(state, gradWeight), 4 ,
345+ " weight tensor has to be contiguous" );
337346
338347 // Params
339348 int nInputPlane = gradWeight->nDimension == 2 ? gradWeight->size [1 ]/(kW *kH ) : gradWeight->size [1 ];
0 commit comments