diff --git a/ngraph/test/util/visitor.hpp b/ngraph/test/util/visitor.hpp index 27955068f1eca5..8c443c0aa43e3c 100644 --- a/ngraph/test/util/visitor.hpp +++ b/ngraph/test/util/visitor.hpp @@ -393,20 +393,14 @@ namespace ngraph AttributeVisitor& get_node_loader() { return *this; } static FactoryRegistry& get_ops() { - static std::shared_ptr> registry; - static std::mutex init_guard; - if (!registry) - { - std::lock_guard guard(init_guard); - if (!registry) - { - registry = std::make_shared>(); -#define NGRAPH_OP(NAME, NAMESPACE, VERSION) registry->register_factory(); + static FactoryRegistry registry = [] { + FactoryRegistry registry; +#define NGRAPH_OP(NAME, NAMESPACE, VERSION) registry.register_factory(); #include "op_version_tbl.hpp" #undef NGRAPH_OP - } - } - return *registry; + return registry; + }(); + return registry; } protected: