Commit db7d8587 authored by Jai Menon's avatar Jai Menon Committed by GitHub

Merge branch 'master' into jmenon/codegen

parents 118e0679 5cb33878
...@@ -35,7 +35,7 @@ namespace ngraph ...@@ -35,7 +35,7 @@ namespace ngraph
{ {
protected: protected:
TensorViewLayout(const ngraph::descriptor::TensorView& tensor_view) TensorViewLayout(const ngraph::descriptor::TensorView& tensor_view)
: m_tensor_view(tensor_view) : m_tensor_view_type(tensor_view.get_tensor_view_type())
{ {
} }
...@@ -53,19 +53,14 @@ namespace ngraph ...@@ -53,19 +53,14 @@ namespace ngraph
const element::Type& get_element_type() const const element::Type& get_element_type() const
{ {
return m_tensor_view.get_tensor_view_type()->get_element_type(); return m_tensor_view_type->get_element_type();
} }
const Shape& get_shape() const { return m_tensor_view_type->get_shape(); }
const Shape& get_shape() const
{
return m_tensor_view.get_tensor_view_type()->get_shape();
}
/// Where this view is located in the buffer. /// Where this view is located in the buffer.
const BufferPos& get_buffer_pos() const { return m_buffer_pos; } const BufferPos& get_buffer_pos() const { return m_buffer_pos; }
BufferPos& get_buffer_pos() { return m_buffer_pos; } BufferPos& get_buffer_pos() { return m_buffer_pos; }
protected: protected:
const ngraph::descriptor::TensorView& m_tensor_view; std::shared_ptr<const TensorViewType> m_tensor_view_type;
BufferPos m_buffer_pos; BufferPos m_buffer_pos;
}; };
} }
......
...@@ -341,14 +341,19 @@ TEST(execute, test_concat_vector) ...@@ -341,14 +341,19 @@ TEST(execute, test_concat_vector)
TEST(execute, test_divide) TEST(execute, test_divide)
{ {
auto shape = Shape{2, 2}; auto make_external = []() {
auto A = make_shared<op::Parameter>(element::Float32::element_type(), shape); auto shape = Shape{2, 2};
auto B = make_shared<op::Parameter>(element::Float32::element_type(), shape); auto A = make_shared<op::Parameter>(element::Float32::element_type(), shape);
auto rt = make_shared<TensorViewType>(element::Float32::element_type(), shape); auto B = make_shared<op::Parameter>(element::Float32::element_type(), shape);
auto f = make_shared<Function>(make_shared<op::Divide>(A, B), rt, op::Parameters{A, B}); auto rt = make_shared<TensorViewType>(element::Float32::element_type(), shape);
auto f = make_shared<Function>(make_shared<op::Divide>(A, B), rt, op::Parameters{A, B});
auto external = make_shared<ngraph::runtime::ExternalFunction>(f); auto external = make_shared<ngraph::runtime::ExternalFunction>(f);
auto cf = external->make_call_frame(); return external;
};
auto shape = Shape{2, 2};
auto cf = make_external()->make_call_frame();
// Create some tensors for input/output // Create some tensors for input/output
auto a = ngraph::runtime::make_tensor<element::Float32>(shape); auto a = ngraph::runtime::make_tensor<element::Float32>(shape);
...@@ -408,16 +413,23 @@ TEST(execute, test_dot_0_0) ...@@ -408,16 +413,23 @@ TEST(execute, test_dot_0_0)
TEST(execute, test_dot_matrix_2x0_0x2) TEST(execute, test_dot_matrix_2x0_0x2)
{ {
auto make_external = []() {
auto shape_a = Shape{2, 0};
auto A = make_shared<op::Parameter>(element::Float32::element_type(), shape_a);
auto shape_b = Shape{0, 2};
auto B = make_shared<op::Parameter>(element::Float32::element_type(), shape_b);
auto shape_r = Shape{2, 2};
auto rt = make_shared<TensorViewType>(element::Float32::element_type(), shape_r);
auto f = make_shared<Function>(make_shared<op::Dot>(A, B), rt, op::Parameters{A, B});
auto external = make_shared<ngraph::runtime::ExternalFunction>(f);
return external;
};
auto shape_a = Shape{2, 0}; auto shape_a = Shape{2, 0};
auto A = make_shared<op::Parameter>(element::Float32::element_type(), shape_a);
auto shape_b = Shape{0, 2}; auto shape_b = Shape{0, 2};
auto B = make_shared<op::Parameter>(element::Float32::element_type(), shape_b);
auto shape_r = Shape{2, 2}; auto shape_r = Shape{2, 2};
auto rt = make_shared<TensorViewType>(element::Float32::element_type(), shape_r); auto cf = make_external()->make_call_frame();
auto f = make_shared<Function>(make_shared<op::Dot>(A, B), rt, op::Parameters{A, B});
auto external = make_shared<ngraph::runtime::ExternalFunction>(f);
auto cf = external->make_call_frame();
// Create some tensors for input/output // Create some tensors for input/output
auto a = ngraph::runtime::make_tensor<element::Float32>(shape_a); auto a = ngraph::runtime::make_tensor<element::Float32>(shape_a);
......
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