Skip to content
Snippets Groups Projects
Commit 0b984f82 authored by Gallas Gaye's avatar Gallas Gaye
Browse files

Pad works now for all size of batch and rectangular aspects

parent 1bac314b
No related branches found
No related tags found
No related merge requests found
Pipeline #69802 canceled
...@@ -23,15 +23,16 @@ void convolution_forward( ...@@ -23,15 +23,16 @@ void convolution_forward(
for (unsigned int oy = 0; oy < oySize; ++oy) { for (unsigned int oy = 0; oy < oySize; ++oy) {
for (unsigned int ox = 0; ox < oxSize; ++ox) { for (unsigned int ox = 0; ox < oxSize; ++ox) {
if (oy < PADDING_Y or oy >= CHANNELS_HEIGHT + PADDING_Y or ox < PADDING_X or ox >= CHANNELS_WIDTH + PADDING_X) for (unsigned int ch = 0; ch < NB_CHANNELS; ++ch) {
{ if (oy < PADDING_Y or oy >= CHANNELS_HEIGHT + PADDING_Y or ox < PADDING_X or ox >= CHANNELS_WIDTH + PADDING_X)
outputs[oy * oxSize + ox] = 0.0f; {
outputs[ch * oxSize * oySize + oy * oxSize + ox] = 0.0f;
}
else
{
outputs[ch * oxSize * oySize + oy * oxSize + ox] = inputs[ch * CHANNELS_WIDTH * CHANNELS_HEIGHT + (oy - PADDING_Y) * CHANNELS_WIDTH + (ox - PADDING_X)];
}
} }
else
{
outputs[oy * oxSize + ox] = inputs[(oy - PADDING_Y) * CHANNELS_WIDTH + (ox - PADDING_X)];
}
} }
} }
} }
......
...@@ -250,7 +250,7 @@ class test_operator_export(unittest.TestCase): ...@@ -250,7 +250,7 @@ class test_operator_export(unittest.TestCase):
aidge_core.Pad2D((1, 1, 1, 1), name="pad2d") aidge_core.Pad2D((1, 1, 1, 1), name="pad2d")
]) ])
self.unit_test_export(model, "Pad2D", [[1, 1, 10, 10]]) self.unit_test_export(model, "Pad2D", [[1, 1, 11, 11]])
def test_export_pad2D_larger(self): def test_export_pad2D_larger(self):
print("Pad2DLarger") print("Pad2DLarger")
...@@ -258,7 +258,7 @@ class test_operator_export(unittest.TestCase): ...@@ -258,7 +258,7 @@ class test_operator_export(unittest.TestCase):
aidge_core.Pad2D((1, 1, 1, 1), name="pad2d") aidge_core.Pad2D((1, 1, 1, 1), name="pad2d")
]) ])
self.unit_test_export(model, "Pad2DLarger", [[1, 1, 5, 10]]) self.unit_test_export(model, "Pad2DLarger", [[1, 1, 7, 11]])
def test_export_pad2D_higher(self): def test_export_pad2D_higher(self):
print("Pad2DHigher") print("Pad2DHigher")
...@@ -266,7 +266,7 @@ class test_operator_export(unittest.TestCase): ...@@ -266,7 +266,7 @@ class test_operator_export(unittest.TestCase):
aidge_core.Pad2D((1, 1, 1, 1), name="pad2d") aidge_core.Pad2D((1, 1, 1, 1), name="pad2d")
]) ])
self.unit_test_export(model, "Pad2DHigher", [[1, 1, 10, 5]]) self.unit_test_export(model, "Pad2DHigher", [[1, 1, 11, 7]])
def test_export_pad2D_denser(self): def test_export_pad2D_denser(self):
print("Pad2DDenser") print("Pad2DDenser")
...@@ -274,7 +274,7 @@ class test_operator_export(unittest.TestCase): ...@@ -274,7 +274,7 @@ class test_operator_export(unittest.TestCase):
aidge_core.Pad2D((1, 1, 1, 1), name="pad2d") aidge_core.Pad2D((1, 1, 1, 1), name="pad2d")
]) ])
self.unit_test_export(model, "Pad2DDenser", [[1, 5, 10, 10]]) self.unit_test_export(model, "Pad2DDenser", [[1, 5, 7, 11]])
def test_export_batchnorm2D(self): def test_export_batchnorm2D(self):
print("BatchNormalization2D") print("BatchNormalization2D")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment