Unverified Commit 2a534555 authored by Scott Cyphers's avatar Scott Cyphers Committed by GitHub

Don't leave output serialization shapes set. (#3824)

parent b9af3723
......@@ -172,6 +172,11 @@ void ngraph::set_serialize_output_shapes(bool enable)
s_serialize_output_shapes_enabled = enable;
}
bool ngraph::get_serialize_output_shapes()
{
return s_serialize_output_shapes_enabled;
}
// This expands the op list in op_tbl.hpp into a list of enumerations that look like this:
// Abs,
// Acos,
......
......@@ -61,4 +61,22 @@ namespace ngraph
///
/// Option may be enabled by setting the environment variable NGRAPH_SERIALIZER_OUTPUT_SHAPES
void set_serialize_output_shapes(bool enable);
bool get_serialize_output_shapes();
class WithSerializeOutputShapesEnabled
{
public:
WithSerializeOutputShapesEnabled(bool enabled = true)
{
m_serialize_output_shapes_enabled = get_serialize_output_shapes();
set_serialize_output_shapes(enabled);
}
~WithSerializeOutputShapesEnabled()
{
set_serialize_output_shapes(m_serialize_output_shapes_enabled);
}
private:
bool m_serialize_output_shapes_enabled;
};
}
......@@ -209,7 +209,7 @@ TEST(benchmark, serialize)
timer.stop();
cout << "deserialize took " << timer.get_milliseconds() << "ms\n";
ngraph::set_serialize_output_shapes(true);
WithSerializeOutputShapesEnabled serialize_outputs(true);
ofstream out("test.json");
out << serialize(f, 4);
}
......
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