Commit 69ee7e7a authored by Artur Wojcik's avatar Artur Wojcik Committed by Scott Cyphers

onnx: fix CentOS compilation after Convolution PR merged (#1488)

Signed-off-by: 's avatarArtur Wojcik <artur.wojcik@intel.com>
parent 559d5890
......@@ -118,14 +118,14 @@ namespace ngraph
std::to_string(groups)};
}
auto strides{attribute::get_strides(node)};
auto dilations{attribute::get_dilations(node)};
auto paddings{attribute::get_pads(node)};
const auto& padding_below{paddings.first};
const auto& padding_above{paddings.second};
auto strides = attribute::get_strides(node);
auto dilations = attribute::get_dilations(node);
auto paddings = attribute::get_pads(node);
const auto& padding_below = paddings.first;
const auto& padding_above = paddings.second;
auto conv_node{make_ng_convolution(
data, filters, strides, dilations, padding_below, padding_above, groups)};
auto conv_node = make_ng_convolution(
data, filters, strides, dilations, padding_below, padding_above, groups);
// no bias param
if (inputs.size() < 3)
......@@ -133,11 +133,11 @@ namespace ngraph
return {conv_node};
}
auto bias{inputs.at(2)};
auto bias = inputs.at(2);
const Shape& new_shape = conv_node->get_shape();
auto broadcasted_bias{std::make_shared<ngraph::op::Broadcast>(
bias, new_shape, calculate_broadcast_axes(new_shape, bias->get_shape(), 1))};
auto broadcasted_bias = std::make_shared<ngraph::op::Broadcast>(
bias, new_shape, calculate_broadcast_axes(new_shape, bias->get_shape(), 1));
return {std::make_shared<ngraph::op::Add>(conv_node, broadcasted_bias)};
}
......
......@@ -133,8 +133,8 @@ namespace
TEST(onnx, mode_conv2d_strides_padding)
{
// Convolution with strides=2 and padding=1
auto function{ngraph::onnx_import::import_onnx_function(
ngraph::file_util::path_join(SERIALIZED_ZOO, "onnx/conv_with_strides_padding.onnx"))};
auto function = ngraph::onnx_import::import_onnx_function(
ngraph::file_util::path_join(SERIALIZED_ZOO, "onnx/conv_with_strides_padding.onnx"));
// (1, 1, 4, 3)
auto expected_output = ngraph::test::NDArray<float, 4>({{{{12.f, 27.f, 24.f},
......@@ -143,37 +143,37 @@ TEST(onnx, mode_conv2d_strides_padding)
{112.f, 177.f, 124.f}}}})
.get_vector();
auto result{conv2d_execute(function)};
auto result = conv2d_execute(function);
EXPECT_EQ(expected_output, result.front());
}
TEST(onnx, model_conv2d_strides_no_padding)
{
// Convolution with strides=2 and padding=1
auto function{ngraph::onnx_import::import_onnx_function(
ngraph::file_util::path_join(SERIALIZED_ZOO, "onnx/conv_with_strides_no_padding.onnx"))};
auto function = ngraph::onnx_import::import_onnx_function(
ngraph::file_util::path_join(SERIALIZED_ZOO, "onnx/conv_with_strides_no_padding.onnx"));
// (1, 1, 3, 2)
auto expected_output =
ngraph::test::NDArray<float, 4>({{{{54.f, 72.f}, {144.f, 162.f}, {234.f, 252.f}}}})
.get_vector();
auto result{conv2d_execute(function)};
auto result = conv2d_execute(function);
EXPECT_EQ(expected_output, result.front());
}
TEST(onnx, model_conv2d_strides_assymetric_padding)
{
// Convolution with strides=2 and padding=1
auto function{ngraph::onnx_import::import_onnx_function(ngraph::file_util::path_join(
SERIALIZED_ZOO, "onnx/conv_with_strides_and_asymmetric_padding.onnx"))};
auto function = ngraph::onnx_import::import_onnx_function(ngraph::file_util::path_join(
SERIALIZED_ZOO, "onnx/conv_with_strides_and_asymmetric_padding.onnx"));
// (1, 1, 4, 2)
auto expected_output = ngraph::test::NDArray<float, 4>(
{{{{21.f, 33.f}, {99.f, 117.f}, {189.f, 207.f}, {171.f, 183.f}}}})
.get_vector();
auto result{conv2d_execute(function)};
auto result = conv2d_execute(function);
EXPECT_EQ(expected_output, result.front());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment