Unverified Commit 9d0d7a7c authored by Robert Kimball's avatar Robert Kimball Committed by GitHub

Yixing/empty tuple (#390)

* add test for empty tuple

* fix null function breaking
parent f6a578b4
......@@ -365,6 +365,11 @@ using namespace ngraph::runtime;
for (shared_ptr<Function> current_function : pass_manager.get_state().get_functions())
{
const list<shared_ptr<Node>>& tmp = current_function->get_ordered_ops();
if (tmp.size() < 2)
{
// Since we are comparing ops there must be at least two ops to proceed.
continue;
}
vector<shared_ptr<Node>> op_list{tmp.begin(), tmp.end()};
for (size_t i = 0; i < op_list.size() - 1; i++)
{
......
......@@ -72,3 +72,29 @@ TEST(builder_xla, simple)
xla::call(cf, {acb}, {result_tuple});
EXPECT_EQ((vector<float>{50, 72, 98, 128}), result->get_vector<float>());
}
TEST(builder_xla, empty_tuple_interpreter)
{
auto empty_tuple = make_shared<xla::op::Tuple>(Nodes{});
auto f = make_shared<xla::XLAFunction>(Nodes{empty_tuple}, Nodes{});
auto manager = runtime::Manager::get("INTERPRETER");
auto external = manager->compile(f);
auto backend = manager->allocate_backend();
auto cf = backend->make_call_frame(external);
xla::call(cf, {}, {});
}
TEST(builder_xla, empty_tuple_cpu)
{
auto empty_tuple = make_shared<xla::op::Tuple>(Nodes{});
auto f = make_shared<xla::XLAFunction>(Nodes{empty_tuple}, Nodes{});
auto manager = runtime::Manager::get("CPU");
auto external = manager->compile(f);
auto backend = manager->allocate_backend();
auto cf = backend->make_call_frame(external);
xla::call(cf, {}, {});
}
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