From: 박세희/동작제어Lab(SR)/Principal Engineer/삼성전자 Date: Thu, 6 Dec 2018 07:42:11 +0000 (+0900) Subject: [enco] frontend/caffe: Introduce GraphBuilderRegistry (#2535) X-Git-Tag: nncc_backup~1173 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5b3c3a5f1731844ce4594d79821d967ffac79cae;p=platform%2Fcore%2Fml%2Fnnfw.git [enco] frontend/caffe: Introduce GraphBuilderRegistry (#2535) This will introduce GraphBuilderRegistry class to register GraphBuilder by layer type Signed-off-by: SaeHie Park --- diff --git a/contrib/enco/frontend/caffe/src/GraphBuilderRegistry.cpp b/contrib/enco/frontend/caffe/src/GraphBuilderRegistry.cpp new file mode 100644 index 0000000..094896d --- /dev/null +++ b/contrib/enco/frontend/caffe/src/GraphBuilderRegistry.cpp @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GraphBuilderRegistry.h" + +namespace caffeimport +{ + +GraphBuilderRegistry::GraphBuilderRegistry() +{ + // TODO add GraphBuilder for each caffe layer. +} + +} // namespace caffeimport diff --git a/contrib/enco/frontend/caffe/src/GraphBuilderRegistry.h b/contrib/enco/frontend/caffe/src/GraphBuilderRegistry.h new file mode 100644 index 0000000..c32a4a6 --- /dev/null +++ b/contrib/enco/frontend/caffe/src/GraphBuilderRegistry.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __GRAPH_BUILDER_REGISTRY_H__ +#define __GRAPH_BUILDER_REGISTRY_H__ + +#include "GraphBuilder.h" + +#include +#include + +namespace caffeimport +{ + +class GraphBuilderRegistry +{ +public: + const GraphBuilder *lookup(std::string op) const + { + if (_builder_map.find(op) == _builder_map.end()) + return nullptr; + + return _builder_map.at(op).get(); + } + + static GraphBuilderRegistry &get() + { + static GraphBuilderRegistry me; + return me; + } + +private: + GraphBuilderRegistry(); + +private: + std::map> _builder_map; +}; + +} // namespace caffeimport + +#endif // __GRAPH_BUILDER_REGISTRY_H__