Unverified Commit 651ff9ff authored by Robert Kimball's avatar Robert Kimball Committed by GitHub

handle unsupported ops (#1816)

parent 15afe106
......@@ -152,7 +152,11 @@ cpio::Writer::Writer(const string& filename)
cpio::Writer::~Writer()
{
close();
write("TRAILER!!!", nullptr, 0);
if (m_my_stream.is_open())
{
m_my_stream.close();
}
}
void cpio::Writer::open(ostream& out)
......@@ -166,15 +170,6 @@ void cpio::Writer::open(const string& filename)
m_my_stream.open(filename, ios_base::binary | ios_base::out);
}
void cpio::Writer::close()
{
write("TRAILER!!!", nullptr, 0);
if (m_my_stream.is_open())
{
m_my_stream.close();
}
}
void cpio::Writer::write(const string& record_name, const void* data, uint32_t size_in_bytes)
{
if (m_stream)
......
......@@ -88,7 +88,6 @@ public:
void open(std::ostream& out);
void open(const std::string& filename);
void close();
void write(const std::string& file_name, const void* data, uint32_t size_in_bytes);
private:
......
......@@ -109,6 +109,7 @@ using const_data_callback_t = shared_ptr<Node>(const string&, const element::Typ
enum class OP_TYPEID
{
#include "ngraph/op/op_tbl.hpp"
UnknownOp
};
#undef NGRAPH_OP
......@@ -123,7 +124,13 @@ static OP_TYPEID get_typeid(const string& s)
#include "ngraph/op/op_tbl.hpp"
};
#undef NGRAPH_OP
return typeid_map.at(s);
OP_TYPEID rc = OP_TYPEID::UnknownOp;
auto it = typeid_map.find(s);
if (it != typeid_map.end())
{
rc = it->second;
}
return rc;
}
template <typename T>
......@@ -208,8 +215,6 @@ void ngraph::serialize(ostream& out, shared_ptr<ngraph::Function> func, size_t i
},
true);
});
writer.close();
}
static string serialize(shared_ptr<ngraph::Function> func, size_t indent, bool binary_constant_data)
......@@ -1024,7 +1029,7 @@ static shared_ptr<ngraph::Function>
node = make_shared<op::StopGradient>(args[0]);
break;
}
default:
case OP_TYPEID::UnknownOp:
{
stringstream ss;
ss << "unsupported op " << node_op;
......@@ -1514,6 +1519,8 @@ static json write(const Node& n, bool binary_constant_data)
node["compute_max"] = tmp->get_compute_max();
break;
}
case OP_TYPEID::UnknownOp: { break;
}
}
#pragma GCC diagnostic pop
......
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