ArgCheck that dilation parameters are > 0.
diff --git a/generic/SpatialDilatedConvolution.c b/generic/SpatialDilatedConvolution.c
index 7479563..f499243 100644
--- a/generic/SpatialDilatedConvolution.c
+++ b/generic/SpatialDilatedConvolution.c
@@ -4,7 +4,7 @@
static inline void THNN_(SpatialDilatedConvolution_shapeCheck)(
THTensor *input, THTensor *gradOutput,
- THTensor *weight, THTensor *bias,
+ THTensor *weight, THTensor *bias,
int kH, int kW, int dH, int dW, int padH, int padW,
int dilationH, int dilationW) {
@@ -15,6 +15,9 @@
"kernel size should be greater than zero, but got kH: %d kW: %d", kH, kW);
THArgCheck(dW > 0 && dH > 0, 11,
"stride should be greater than zero, but got dH: %d dW: %d", dH, dW);
+ THArgCheck(dilationW > 0 && dilationH > 0, 15,
+ "dilation should be greater than zero, but got dilationH: %d, dilationW: %d",
+ dilationH, dilationW);
THNN_ARGCHECK(weight->nDimension == 2 || weight->nDimension == 4, 5, weight,
"2D or 4D weight tensor expected, but got: %s");
@@ -49,7 +52,7 @@
nInputPlane,inputHeight,inputWidth,nOutputPlane,outputHeight,outputWidth);
THNN_CHECK_DIM_SIZE(input, ndim, dimf, nInputPlane);
-
+
if (gradOutput != NULL) {
THNN_CHECK_DIM_SIZE(gradOutput, ndim, dimf, nOutputPlane);
THNN_CHECK_DIM_SIZE(gradOutput, ndim, dimh, outputHeight);
diff --git a/generic/SpatialDilatedMaxPooling.c b/generic/SpatialDilatedMaxPooling.c
index 1d25e8f..3bcff79 100644
--- a/generic/SpatialDilatedMaxPooling.c
+++ b/generic/SpatialDilatedMaxPooling.c
@@ -11,6 +11,9 @@
"kernel size should be greater than zero, but got kH: %d kW: %d", kH, kW);
THArgCheck(dW > 0 && dH > 0, 8,
"stride should be greater than zero, but got dH: %d dW: %d", dH, dW);
+ THArgCheck(dW > 0 && dH > 0, 12,
+ "dilation should be greater than zero, but got dilationH: %d dilationW: %d",
+ dilationH, dilationW);
int ndim = input->nDimension;
int dimf = 0;
diff --git a/generic/VolumetricDilatedConvolution.c b/generic/VolumetricDilatedConvolution.c
index b226f32..e889f5a 100644
--- a/generic/VolumetricDilatedConvolution.c
+++ b/generic/VolumetricDilatedConvolution.c
@@ -23,6 +23,7 @@
THArgCheck(!bias || weight->size[0] == bias->size[0], 4, "nOutputPlane mismatch in weight and bias");
THArgCheck(kT > 0 && kW > 0 && kH > 0, 8, "kernel size should be greater than zero");
THArgCheck(dT > 0 && dW > 0 && dH > 0, 10, "stride should be greater than zero");
+ THArgCheck(dilationT > 0 && dilationW > 0 && dilationH > 0, 17, "dilation should be greater than zero");
// Params:
int nInputPlane = weight->size[1];
diff --git a/generic/VolumetricDilatedMaxPooling.c b/generic/VolumetricDilatedMaxPooling.c
index 940c6fe..629c05a 100644
--- a/generic/VolumetricDilatedMaxPooling.c
+++ b/generic/VolumetricDilatedMaxPooling.c
@@ -160,6 +160,9 @@
"pad should be smaller than half of kernel size"
);
+ THArgCheck(dilationT > 0 && dilationW > 0 && dilationH > 0, 14,
+ "dilation should be greater than 0");
+
/* sizes */
nslices = input->size[dimN];
itime = input->size[dimt];