Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/cunn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/THCUNN/generic/SpatialDilatedConvolution.cu1
-rw-r--r--lib/THCUNN/generic/SpatialDilatedMaxPooling.cu2
-rw-r--r--lib/THCUNN/generic/VolumetricDilatedConvolution.cu1
-rw-r--r--lib/THCUNN/generic/VolumetricDilatedMaxPooling.cu3
-rw-r--r--test.lua12
5 files changed, 12 insertions, 7 deletions
diff --git a/lib/THCUNN/generic/SpatialDilatedConvolution.cu b/lib/THCUNN/generic/SpatialDilatedConvolution.cu
index 1ddfb06..6c446ac 100644
--- a/lib/THCUNN/generic/SpatialDilatedConvolution.cu
+++ b/lib/THCUNN/generic/SpatialDilatedConvolution.cu
@@ -24,6 +24,7 @@ void THNN_(SpatialDilatedConvolution_updateOutput)(
THArgCheck(!bias || weight->size[0] == bias->size[0], 4, "nOutputPlane mismatch in weight and bias");
THArgCheck(kW > 0 && kH > 0, 8, "kernel size should be greater than zero");
THArgCheck(dW > 0 && dH > 0, 10, "stride should be greater than zero");
+ THArgCheck(dilationW > 0 && dilationH > 0, 14, "dilation should be greater than 0");
// Params:
int nInputPlane = weight->size[1];
diff --git a/lib/THCUNN/generic/SpatialDilatedMaxPooling.cu b/lib/THCUNN/generic/SpatialDilatedMaxPooling.cu
index a44db4a..b99b5e6 100644
--- a/lib/THCUNN/generic/SpatialDilatedMaxPooling.cu
+++ b/lib/THCUNN/generic/SpatialDilatedMaxPooling.cu
@@ -38,7 +38,7 @@ void THNN_(SpatialDilatedMaxPooling_updateOutput)(
THArgCheck(nInputCols >= kW - padW && nInputRows >= kH - padH, 2, "input image smaller than kernel size");
THArgCheck(kW/2 >= padW && kH/2 >= padH, 2, "pad should be smaller than half of kernel size");
-
+ THArgCheck(dilationW > 0 && dilationH > 0, 11, "dilation should be greater than 0");
if(ceil_mode) {
nOutputCols = ceil(float(nInputCols - (dilationW * (kW - 1) + 1) + 2*padW) / float(dW)) + 1;
nOutputRows = ceil(float(nInputRows - (dilationH * (kH - 1) + 1) + 2*padH) / float(dH)) + 1;
diff --git a/lib/THCUNN/generic/VolumetricDilatedConvolution.cu b/lib/THCUNN/generic/VolumetricDilatedConvolution.cu
index b10cc98..22536fe 100644
--- a/lib/THCUNN/generic/VolumetricDilatedConvolution.cu
+++ b/lib/THCUNN/generic/VolumetricDilatedConvolution.cu
@@ -24,6 +24,7 @@ void THNN_(VolumetricDilatedConvolution_updateOutput)(
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, 16, "dilation should be greater than 0");
// Params:
int nInputPlane = weight->size[1];
diff --git a/lib/THCUNN/generic/VolumetricDilatedMaxPooling.cu b/lib/THCUNN/generic/VolumetricDilatedMaxPooling.cu
index bd43bc0..0d6d084 100644
--- a/lib/THCUNN/generic/VolumetricDilatedMaxPooling.cu
+++ b/lib/THCUNN/generic/VolumetricDilatedMaxPooling.cu
@@ -71,6 +71,9 @@ void THNN_(VolumetricDilatedMaxPooling_updateOutput)(
THArgCheck(kT/2 >= padT && kW/2 >= padW && kH/2 >= padH, 2,
"pad should be smaller than half of kernel size"
);
+ THArgCheck(dilationT > 0 && dilationW > 0 && dilationH > 0, 14,
+ "dilation should be greater than 0"
+ );
if (ceilMode)
{
diff --git a/test.lua b/test.lua
index 5bc10c0..434a272 100644
--- a/test.lua
+++ b/test.lua
@@ -1664,8 +1664,8 @@ function cunntest.SpatialDilatedConvolution_forward_batch()
local padH = math.random(0,1)
local outi = math.random(ki, 64)
local outj = math.random(kj, 64)
- local dilationW = math.random(0,10)
- local dilationH = math.random(0,10)
+ local dilationW = math.random(1,10)
+ local dilationH = math.random(1,10)
local ini = (outi - 1) * si - 2 * padW + dilationW * (ki-1) + 1
local inj = (outj - 1) * sj - 2 * padH + dilationH * (kj-1) + 1
@@ -1700,8 +1700,8 @@ function cunntest.SpatialDilatedConvolution_backward_single()
local padH = math.random(0,1)
local outi = math.random(ki, 64)
local outj = math.random(kj, 64)
- local dilationW = math.random(0,10)
- local dilationH = math.random(0,10)
+ local dilationW = math.random(1,10)
+ local dilationH = math.random(1,10)
local ini = (outi - 1) * si - 2 * padW + dilationW * (ki-1) + 1
local inj = (outj - 1) * sj - 2 * padH + dilationH * (kj-1) + 1
@@ -1754,8 +1754,8 @@ function cunntest.SpatialDilatedConvolution_backward_batch()
local padH = math.random(0,1)
local outi = math.random(ki, 64)
local outj = math.random(kj, 64)
- local dilationW = math.random(0,10)
- local dilationH = math.random(0,10)
+ local dilationW = math.random(1,10)
+ local dilationH = math.random(1,10)
local ini = (outi - 1) * si - 2 * padW + dilationW * (ki-1) + 1
local inj = (outj - 1) * sj - 2 * padH + dilationH * (kj-1) + 1