Commit dd8017f9 authored by Jayaram Bobba's avatar Jayaram Bobba

Merge branch 'master' into jmenon/cpu_layout_infra

parents 6bf066d7 00fb503f
This diff is collapsed.
...@@ -246,6 +246,8 @@ void runtime::cpu::CPU_ExternalFunction::compile() ...@@ -246,6 +246,8 @@ void runtime::cpu::CPU_ExternalFunction::compile()
for (shared_ptr<Node> node : current_function->get_ordered_ops()) for (shared_ptr<Node> node : current_function->get_ordered_ops())
{ {
if (dynamic_cast<op::Convolution*>(node.get()) || if (dynamic_cast<op::Convolution*>(node.get()) ||
dynamic_cast<op::ConvolutionBackpropData*>(node.get()) ||
dynamic_cast<op::ConvolutionBackpropFilters*>(node.get()) ||
dynamic_cast<op::AvgPool*>(node.get()) || dynamic_cast<op::MaxPool*>(node.get()) || dynamic_cast<op::AvgPool*>(node.get()) || dynamic_cast<op::MaxPool*>(node.get()) ||
dynamic_cast<op::AvgPoolBackprop*>(node.get())) dynamic_cast<op::AvgPoolBackprop*>(node.get()))
{ {
...@@ -263,6 +265,7 @@ void runtime::cpu::CPU_ExternalFunction::compile() ...@@ -263,6 +265,7 @@ void runtime::cpu::CPU_ExternalFunction::compile()
writer += writer +=
R"(#include <Eigen/Dense> R"(#include <Eigen/Dense>
#include "ngraph/except.hpp"
#include "ngraph/runtime/aligned_buffer.hpp" #include "ngraph/runtime/aligned_buffer.hpp"
#include "ngraph/runtime/cpu/cpu_eigen_utils.hpp" #include "ngraph/runtime/cpu/cpu_eigen_utils.hpp"
#include "ngraph/runtime/cpu/cpu_kernels.hpp" #include "ngraph/runtime/cpu/cpu_kernels.hpp"
......
...@@ -69,7 +69,7 @@ ngraph::op::MatmulBias::MatmulBias(std::shared_ptr<ngraph::Node> W, ...@@ -69,7 +69,7 @@ ngraph::op::MatmulBias::MatmulBias(std::shared_ptr<ngraph::Node> W,
throw ngraph_error("product dimensions are not equal while creating MatmulBias"); throw ngraph_error("product dimensions are not equal while creating MatmulBias");
} }
auto dot_shape = Shape{shape_w.at(1 - dot_dimension_w), shape_x.at(1 - dot_dimension_x)}; Shape dot_shape{shape_w.at(1 - dot_dimension_w), shape_x.at(1 - dot_dimension_x)};
NGRAPH_DEBUG << "dot_shape shape = " << vector_to_string(dot_shape) NGRAPH_DEBUG << "dot_shape shape = " << vector_to_string(dot_shape)
<< " , b shape = " << vector_to_string(b->get_shape()); << " , b shape = " << vector_to_string(b->get_shape());
......
...@@ -99,10 +99,10 @@ static std::vector<T> apply_permutation(std::vector<T> input, ngraph::AxisVector ...@@ -99,10 +99,10 @@ static std::vector<T> apply_permutation(std::vector<T> input, ngraph::AxisVector
void ngraph::runtime::cpu::pass::CPUFusion::construct_gemm_pattern() void ngraph::runtime::cpu::pass::CPUFusion::construct_gemm_pattern()
{ {
auto shape_w = Shape{2, 4}; Shape shape_w{2, 4};
auto shape_x = Shape{4, 1}; Shape shape_x{4, 1};
auto shape_b = Shape{1}; Shape shape_b{1};
auto shape_dot = Shape{2, 1}; Shape shape_dot{2, 1};
auto W = std::make_shared<pattern::op::Label>(element::f32, shape_w); auto W = std::make_shared<pattern::op::Label>(element::f32, shape_w);
auto x = std::make_shared<pattern::op::Label>(element::f32, shape_x); auto x = std::make_shared<pattern::op::Label>(element::f32, shape_x);
......
...@@ -45,11 +45,11 @@ using namespace std; ...@@ -45,11 +45,11 @@ using namespace std;
TEST(Argon_fusion, fuse_max_with_constant_zero_input_as_relu) TEST(Argon_fusion, fuse_max_with_constant_zero_input_as_relu)
{ {
auto shape_a = Shape{1, 5}; Shape shape_a{1, 5};
auto A = op::Constant::create(element::f32, shape_a, {0, 0, 0, 0, 0}); auto A = op::Constant::create(element::f32, shape_a, {0, 0, 0, 0, 0});
auto B = make_shared<op::Parameter>(element::f32, shape_a); auto B = make_shared<op::Parameter>(element::f32, shape_a);
auto max = make_shared<op::Maximum>(A, B); auto max = make_shared<op::Maximum>(A, B);
auto shape_rt = Shape{1, 5}; Shape shape_rt{1, 5};
auto f = make_shared<Function>(max, op::Parameters{B}); auto f = make_shared<Function>(max, op::Parameters{B});
auto manager = runtime::Manager::get("ARGON"); auto manager = runtime::Manager::get("ARGON");
......
This diff is collapsed.
...@@ -30,7 +30,7 @@ using namespace ngraph; ...@@ -30,7 +30,7 @@ using namespace ngraph;
TEST(INTERPRETER, nan_check_input) TEST(INTERPRETER, nan_check_input)
{ {
auto shape = Shape{4}; Shape shape{4};
auto A = make_shared<op::Parameter>(element::f32, shape); auto A = make_shared<op::Parameter>(element::f32, shape);
auto B = make_shared<op::Parameter>(element::f32, shape); auto B = make_shared<op::Parameter>(element::f32, shape);
auto f = make_shared<Function>(make_shared<op::Divide>(A, B), op::Parameters{A, B}); auto f = make_shared<Function>(make_shared<op::Divide>(A, B), op::Parameters{A, B});
...@@ -56,7 +56,7 @@ TEST(INTERPRETER, nan_check_input) ...@@ -56,7 +56,7 @@ TEST(INTERPRETER, nan_check_input)
TEST(INTERPRETER, nan_check_output) TEST(INTERPRETER, nan_check_output)
{ {
auto shape = Shape{4}; Shape shape{4};
auto A = make_shared<op::Parameter>(element::f32, shape); auto A = make_shared<op::Parameter>(element::f32, shape);
auto B = make_shared<op::Parameter>(element::f32, shape); auto B = make_shared<op::Parameter>(element::f32, shape);
auto f = make_shared<Function>(make_shared<op::Divide>(A, B), op::Parameters{A, B}); auto f = make_shared<Function>(make_shared<op::Divide>(A, B), op::Parameters{A, B});
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -25,9 +25,9 @@ using namespace std; ...@@ -25,9 +25,9 @@ using namespace std;
shared_ptr<runtime::TensorView> shared_ptr<runtime::TensorView>
make_reduce_result(function<shared_ptr<Node>(const shared_ptr<Node>&, const AxisSet&)> func) make_reduce_result(function<shared_ptr<Node>(const shared_ptr<Node>&, const AxisSet&)> func)
{ {
auto shape_a = Shape{3, 2}; Shape shape_a{3, 2};
auto A = make_shared<op::Parameter>(element::f32, shape_a); auto A = make_shared<op::Parameter>(element::f32, shape_a);
auto shape_rt = Shape{2}; Shape shape_rt{2};
auto f = make_shared<Function>(func(A, {0}), op::Parameters{A}); auto f = make_shared<Function>(func(A, {0}), op::Parameters{A});
auto manager = runtime::Manager::get("INTERPRETER"); auto manager = runtime::Manager::get("INTERPRETER");
auto external = manager->compile(f); auto external = manager->compile(f);
...@@ -45,9 +45,9 @@ shared_ptr<runtime::TensorView> ...@@ -45,9 +45,9 @@ shared_ptr<runtime::TensorView>
shared_ptr<runtime::TensorView> make_reduce_result_true( shared_ptr<runtime::TensorView> make_reduce_result_true(
function<shared_ptr<Node>(const shared_ptr<Node>&, const AxisSet&, bool)> func) function<shared_ptr<Node>(const shared_ptr<Node>&, const AxisSet&, bool)> func)
{ {
auto shape_a = Shape{3, 2}; Shape shape_a{3, 2};
auto A = make_shared<op::Parameter>(element::f32, shape_a); auto A = make_shared<op::Parameter>(element::f32, shape_a);
auto shape_rt = Shape{2}; Shape shape_rt{2};
auto f = make_shared<Function>(func(A, {0}, true), op::Parameters{A}); auto f = make_shared<Function>(func(A, {0}, true), op::Parameters{A});
auto manager = runtime::Manager::get("INTERPRETER"); auto manager = runtime::Manager::get("INTERPRETER");
auto external = manager->compile(f); auto external = manager->compile(f);
...@@ -65,9 +65,9 @@ shared_ptr<runtime::TensorView> make_reduce_result_true( ...@@ -65,9 +65,9 @@ shared_ptr<runtime::TensorView> make_reduce_result_true(
shared_ptr<runtime::TensorView> make_reduce_result_false( shared_ptr<runtime::TensorView> make_reduce_result_false(
function<shared_ptr<Node>(const shared_ptr<Node>&, const AxisSet&, bool)> func) function<shared_ptr<Node>(const shared_ptr<Node>&, const AxisSet&, bool)> func)
{ {
auto shape_a = Shape{3, 2}; Shape shape_a{3, 2};
auto A = make_shared<op::Parameter>(element::f32, shape_a); auto A = make_shared<op::Parameter>(element::f32, shape_a);
auto shape_rt = Shape{2}; Shape shape_rt{2};
auto f = make_shared<Function>(func(A, {0}, false), op::Parameters{A}); auto f = make_shared<Function>(func(A, {0}, false), op::Parameters{A});
auto manager = runtime::Manager::get("INTERPRETER"); auto manager = runtime::Manager::get("INTERPRETER");
auto external = manager->compile(f); auto external = manager->compile(f);
......
...@@ -27,7 +27,7 @@ using namespace ngraph; ...@@ -27,7 +27,7 @@ using namespace ngraph;
TEST(builder_xla, simple) TEST(builder_xla, simple)
{ {
auto shape = Shape{2, 2}; Shape shape{2, 2};
auto pA = make_shared<op::Parameter>(element::f32, shape); auto pA = make_shared<op::Parameter>(element::f32, shape);
auto pB = make_shared<op::Parameter>(element::f32, shape); auto pB = make_shared<op::Parameter>(element::f32, shape);
......
This diff is collapsed.
...@@ -45,9 +45,9 @@ using namespace std; ...@@ -45,9 +45,9 @@ using namespace std;
TEST(cpu_fusion, gemm_pattern) TEST(cpu_fusion, gemm_pattern)
{ {
auto shape_w = Shape{2, 4}; Shape shape_w{2, 4};
auto shape_x = Shape{4, 1}; Shape shape_x{4, 1};
auto shape_b = Shape{1}; Shape shape_b{1};
auto A = make_shared<op::Parameter>(element::f32, shape_w); auto A = make_shared<op::Parameter>(element::f32, shape_w);
auto B = make_shared<op::Parameter>(element::f32, shape_x); auto B = make_shared<op::Parameter>(element::f32, shape_x);
auto C = make_shared<op::Parameter>(element::f32, shape_b); auto C = make_shared<op::Parameter>(element::f32, shape_b);
...@@ -92,9 +92,9 @@ TEST(cpu_fusion, gemm_pattern) ...@@ -92,9 +92,9 @@ TEST(cpu_fusion, gemm_pattern)
TEST(cpu_fusion, gemm_cpu) TEST(cpu_fusion, gemm_cpu)
{ {
auto shapeA = Shape{3, 2}; Shape shapeA{3, 2};
auto shapeB = Shape{2, 3}; Shape shapeB{2, 3};
auto shapeC = Shape{2, 2}; Shape shapeC{2, 2};
auto A = make_shared<op::Parameter>(element::f32, shapeA); auto A = make_shared<op::Parameter>(element::f32, shapeA);
auto B = make_shared<op::Parameter>(element::f32, shapeB); auto B = make_shared<op::Parameter>(element::f32, shapeB);
...@@ -131,10 +131,10 @@ TEST(cpu_fusion, gemm_cpu) ...@@ -131,10 +131,10 @@ TEST(cpu_fusion, gemm_cpu)
TEST(cpu_fusion, cpu_fusion_pass_basic) TEST(cpu_fusion, cpu_fusion_pass_basic)
{ {
auto shape = Shape{}; Shape shape{};
auto shape_w = Shape{2, 4}; Shape shape_w{2, 4};
auto shape_x = Shape{4, 1}; Shape shape_x{4, 1};
auto shape_b = Shape{1}; Shape shape_b{1};
auto A = make_shared<op::Parameter>(element::f32, shape_w); auto A = make_shared<op::Parameter>(element::f32, shape_w);
auto B = make_shared<op::Parameter>(element::f32, shape_x); auto B = make_shared<op::Parameter>(element::f32, shape_x);
auto C = make_shared<op::Parameter>(element::f32, shape_b); auto C = make_shared<op::Parameter>(element::f32, shape_b);
......
...@@ -28,7 +28,7 @@ using namespace std; ...@@ -28,7 +28,7 @@ using namespace std;
TEST(inline, basic) TEST(inline, basic)
{ {
auto shape = Shape{2, 2}; Shape shape{2, 2};
auto A = make_shared<op::Parameter>(element::f32, shape); auto A = make_shared<op::Parameter>(element::f32, shape);
auto B = make_shared<op::Parameter>(element::f32, shape); auto B = make_shared<op::Parameter>(element::f32, shape);
auto C = make_shared<op::Parameter>(element::f32, shape); auto C = make_shared<op::Parameter>(element::f32, shape);
...@@ -53,7 +53,7 @@ TEST(inline, basic) ...@@ -53,7 +53,7 @@ TEST(inline, basic)
TEST(inline, recursive) TEST(inline, recursive)
{ {
auto shape = Shape{2, 2}; Shape shape{2, 2};
auto A = make_shared<op::Parameter>(element::f32, shape); auto A = make_shared<op::Parameter>(element::f32, shape);
auto B = make_shared<op::Parameter>(element::f32, shape); auto B = make_shared<op::Parameter>(element::f32, shape);
auto f = make_shared<Function>((A + B), op::Parameters{A, B}); auto f = make_shared<Function>((A + B), op::Parameters{A, B});
......
...@@ -37,7 +37,7 @@ namespace ng = ngraph; ...@@ -37,7 +37,7 @@ namespace ng = ngraph;
TEST(liveness, constant) TEST(liveness, constant)
{ {
auto shape = Shape{1}; Shape shape{1};
auto c = op::Constant::create(element::i32, shape, {5}); auto c = op::Constant::create(element::i32, shape, {5});
auto f = make_shared<Function>(make_shared<op::Negative>(c), op::Parameters{}); auto f = make_shared<Function>(make_shared<op::Negative>(c), op::Parameters{});
......
...@@ -45,7 +45,7 @@ TEST(pass_manager, add) ...@@ -45,7 +45,7 @@ TEST(pass_manager, add)
TEST(pass_manager, module_add_function) TEST(pass_manager, module_add_function)
{ {
// First create "f(A,B,C) = (A+B)*C". // First create "f(A,B,C) = (A+B)*C".
auto shape = Shape{2, 2}; Shape shape{2, 2};
auto A = make_shared<op::Parameter>(element::f32, shape); auto A = make_shared<op::Parameter>(element::f32, shape);
auto B = make_shared<op::Parameter>(element::f32, shape); auto B = make_shared<op::Parameter>(element::f32, shape);
auto C = make_shared<op::Parameter>(element::f32, shape); auto C = make_shared<op::Parameter>(element::f32, shape);
......
...@@ -227,7 +227,7 @@ TEST(memory_layout, constant) ...@@ -227,7 +227,7 @@ TEST(memory_layout, constant)
pass_manager.register_pass<pass::MemoryLayout>(); pass_manager.register_pass<pass::MemoryLayout>();
pass_manager.register_pass<pass::DumpSorted>(dump_file); pass_manager.register_pass<pass::DumpSorted>(dump_file);
auto shape = Shape{1}; Shape shape{1};
auto c = op::Constant::create(element::i32, shape, {5}); auto c = op::Constant::create(element::i32, shape, {5});
auto f = make_shared<Function>(make_shared<op::Negative>(c), op::Parameters{}); auto f = make_shared<Function>(make_shared<op::Negative>(c), op::Parameters{});
......
...@@ -257,7 +257,7 @@ static void run_passes(pass::Manager& pass_manager, ...@@ -257,7 +257,7 @@ static void run_passes(pass::Manager& pass_manager,
TEST(pattern, graph_rewrite) TEST(pattern, graph_rewrite)
{ {
auto shape = Shape{}; Shape shape{};
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<TestGraphRewrite>(); pass_manager.register_pass<TestGraphRewrite>();
...@@ -374,7 +374,7 @@ TEST(pattern, graph_rewrite) ...@@ -374,7 +374,7 @@ TEST(pattern, graph_rewrite)
TEST(pattern, matcher) TEST(pattern, matcher)
{ {
auto shape = Shape{}; Shape shape{};
auto a = make_shared<op::Parameter>(element::i32, shape); auto a = make_shared<op::Parameter>(element::i32, shape);
TestMatcher n(nullptr); TestMatcher n(nullptr);
ASSERT_TRUE(n.match(a, a)); ASSERT_TRUE(n.match(a, a));
......
...@@ -212,11 +212,11 @@ def emit_test(t,f): ...@@ -212,11 +212,11 @@ def emit_test(t,f):
template = ''' template = '''
TEST (${BACKEND_NAME}, %s) TEST (${BACKEND_NAME}, %s)
{ {
auto shape_a = Shape{%s}; Shape shape_a{%s};
auto A = make_shared<op::Parameter>(element::f32, shape_a); auto A = make_shared<op::Parameter>(element::f32, shape_a);
auto shape_b = Shape{%s}; Shape shape_b{%s};
auto B = make_shared<op::Parameter>(element::f32, shape_b); auto B = make_shared<op::Parameter>(element::f32, shape_b);
auto shape_r = Shape{%s}; Shape shape_r{%s};
auto make_graph = [A, B] { auto make_graph = [A, B] {
return make_shared<Function>(make_shared<op::Convolution>(A, B, return make_shared<Function>(make_shared<op::Convolution>(A, B,
Strides{%s}, // move_strides Strides{%s}, // move_strides
......
...@@ -33,7 +33,7 @@ using json = nlohmann::json; ...@@ -33,7 +33,7 @@ using json = nlohmann::json;
TEST(serialize, main) TEST(serialize, main)
{ {
// First create "f(A,B,C) = (A+B)*C". // First create "f(A,B,C) = (A+B)*C".
auto shape = Shape{2, 2}; Shape shape{2, 2};
auto A = make_shared<op::Parameter>(element::f32, shape); auto A = make_shared<op::Parameter>(element::f32, shape);
auto B = make_shared<op::Parameter>(element::f32, shape); auto B = make_shared<op::Parameter>(element::f32, shape);
auto C = make_shared<op::Parameter>(element::f32, shape); auto C = make_shared<op::Parameter>(element::f32, shape);
......
This diff is collapsed.
...@@ -206,7 +206,7 @@ TEST(util, all_close) ...@@ -206,7 +206,7 @@ TEST(util, all_close)
TEST(util, traverse_functions) TEST(util, traverse_functions)
{ {
// First create "f(A,B,C) = (A+B)*C". // First create "f(A,B,C) = (A+B)*C".
auto shape = Shape{2, 2}; Shape shape{2, 2};
auto A = make_shared<op::Parameter>(element::f32, shape); auto A = make_shared<op::Parameter>(element::f32, shape);
auto B = make_shared<op::Parameter>(element::f32, shape); auto B = make_shared<op::Parameter>(element::f32, shape);
auto C = make_shared<op::Parameter>(element::f32, shape); auto C = make_shared<op::Parameter>(element::f32, shape);
...@@ -320,7 +320,7 @@ TEST_F(CloneTest, clone_function_full) ...@@ -320,7 +320,7 @@ TEST_F(CloneTest, clone_function_full)
TEST(graph_util, clone_multiple_results) TEST(graph_util, clone_multiple_results)
{ {
auto shape = Shape{2, 2}; Shape shape{2, 2};
auto A = make_shared<op::Parameter>(element::f32, shape); auto A = make_shared<op::Parameter>(element::f32, shape);
auto B = make_shared<op::Parameter>(element::f32, shape); auto B = make_shared<op::Parameter>(element::f32, shape);
auto C = make_shared<op::Parameter>(element::f32, shape); auto C = make_shared<op::Parameter>(element::f32, shape);
......
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