Commit 1ce31a49 authored by Tomasz Socha's avatar Tomasz Socha Committed by Michał Karzyński

[SPEC] Add v1:Convolution operator (#3636)

parent ac4676ff
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -22,6 +22,7 @@
#include "ngraph/code_writer.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/avg_pool.hpp"
#include "ngraph/op/convolution.hpp"
#include "ngraph/op/gather.hpp"
#include "ngraph/op/max_pool.hpp"
#include "ngraph/op/pad.hpp"
......@@ -109,10 +110,7 @@ namespace ngraph
class QuantizedConvolution;
class GroupConvolution;
class GroupConvolutionBias;
class Convolution;
class ConvolutionBackpropFilters;
class DeconvolutionBias;
class ConvolutionBackpropData;
class QuantizedConvolutionBias;
class QuantizedConvolutionBiasAdd;
class QuantizedConvolutionBiasSignedAdd;
......
This diff is collapsed.
......@@ -69,13 +69,14 @@ set(SRC
node_input_output.cpp
nop_elimination.cpp
op.cpp
opset_pass/convolution_opset_pass.cpp
opset_pass/gather_opset_pass.cpp
opset_pass/pad_opset_pass.cpp
opset_pass/poolings_opset_pass.cpp
opset_pass/product_opset_pass.cpp
opset_pass/reverse_opset_pass.cpp
opset_pass/softmax_opset_pass.cpp
opset_pass/sum_opset_pass.cpp
opset_pass/poolings_opset_pass.cpp
partial_shape.cpp
pass.cpp
pass_liveness.cpp
......
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "ngraph/ngraph.hpp"
#include "ngraph/pass/manager.hpp"
#include "ngraph/pass/opset1_upgrade.hpp"
#include "util/test_control.hpp"
#include "util/type_prop.hpp"
using namespace std;
using namespace ngraph;
TEST(upgrade_pass, opset1_convolution_pass)
{
auto data = make_shared<op::Parameter>(element::f32, Shape{1, 3, 6, 9});
auto filters = make_shared<op::Parameter>(element::f32, Shape{1, 3, 3, 3});
CoordinateDiff pads_begin{0, 0};
CoordinateDiff pads_end{0, 0};
Strides strides{1, 1};
Strides dilations{1, 1};
Strides data_dilations_strides{1, 1};
op::PadType pad_type = op::PadType::EXPLICIT;
auto convolution_v0 = make_shared<op::v0::Convolution>(
data, filters, strides, dilations, pads_begin, pads_end, data_dilations_strides, pad_type);
auto result = make_shared<op::Result>(convolution_v0);
auto f = make_shared<Function>(ResultVector{result}, ParameterVector{data, filters});
ngraph::pass::Manager pass_manager;
pass_manager.register_pass<pass::Opset1Upgrade>();
pass_manager.run_passes(f);
auto convolution_s1_result = f->get_results().at(0);
auto node = convolution_s1_result->input(0).get_source_output().get_node_shared_ptr();
auto convolution_v1_node = static_pointer_cast<op::v1::Convolution>(node);
EXPECT_EQ(convolution_v1_node->description(), "Convolution");
EXPECT_EQ(convolution_v1_node->get_version(), 1);
EXPECT_EQ(convolution_v1_node->get_pads_begin(), pads_begin);
EXPECT_EQ(convolution_v1_node->get_pads_end(), pads_end);
EXPECT_EQ(convolution_v1_node->get_strides(), strides);
EXPECT_EQ(convolution_v1_node->get_auto_pad(), pad_type);
EXPECT_EQ(convolution_v1_node->get_dilations(), dilations);
}
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