提交 a850dec9 编写于 作者: H hedaoyuan

Add dilation.

上级 19547943
...@@ -233,6 +233,8 @@ public: ...@@ -233,6 +233,8 @@ public:
strideW(), strideW(),
paddingH(), paddingH(),
paddingW(), paddingW(),
dilationH(),
dilationW(),
colHeightStart, colHeightStart,
K, K,
colWidthStart, colWidthStart,
......
...@@ -109,6 +109,8 @@ public: ...@@ -109,6 +109,8 @@ public:
int strideWidth, int strideWidth,
int paddingHeight, int paddingHeight,
int paddingWidth, int paddingWidth,
int dilationHeight,
int dilationWidth,
int colHeightStart, int colHeightStart,
int colHeightSize, int colHeightSize,
int colWidthStart, int colWidthStart,
...@@ -128,8 +130,8 @@ public: ...@@ -128,8 +130,8 @@ public:
int h = (colWidthStart + colw) / outputWidth; int h = (colWidthStart + colw) / outputWidth;
int w = (colWidthStart + colw) % outputWidth; int w = (colWidthStart + colw) % outputWidth;
int imRowIdx = h * strideHeight + hOffset; int imRowIdx = h * strideHeight + hOffset * dilationHeight;
int imColIdx = w * strideWidth + wOffset; int imColIdx = w * strideWidth + wOffset * dilationWidth;
if ((imRowIdx - paddingHeight) < 0 || if ((imRowIdx - paddingHeight) < 0 ||
(imRowIdx - paddingHeight) >= inputHeight || (imRowIdx - paddingHeight) >= inputHeight ||
(imColIdx - paddingWidth) < 0 || (imColIdx - paddingWidth) < 0 ||
......
...@@ -147,7 +147,7 @@ void TestIm2ColMobileFunctor() { ...@@ -147,7 +147,7 @@ void TestIm2ColMobileFunctor() {
for (size_t filterWidth : {3, 7}) { for (size_t filterWidth : {3, 7}) {
for (size_t stride : {1, 2}) { for (size_t stride : {1, 2}) {
for (size_t padding : {0, 1}) { for (size_t padding : {0, 1}) {
for (size_t dilation : {1 /*, 3*/}) { for (size_t dilation : {1, 3}) {
size_t filterSizeH = (filterHeight - 1) * dilation + 1; size_t filterSizeH = (filterHeight - 1) * dilation + 1;
size_t filterSizeW = (filterWidth - 1) * dilation + 1; size_t filterSizeW = (filterWidth - 1) * dilation + 1;
if (inputHeight + 2 * padding < filterSizeH || if (inputHeight + 2 * padding < filterSizeH ||
...@@ -200,6 +200,8 @@ void TestIm2ColMobileFunctor() { ...@@ -200,6 +200,8 @@ void TestIm2ColMobileFunctor() {
stride, stride,
padding, padding,
padding, padding,
dilation,
dilation,
0, 0,
height, height,
0, 0,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册