From efc9882ca65016a1426fc86ff437d6e6fd57a426 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=84=B8=ED=9D=AC/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Principal=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Thu, 6 Dec 2018 14:08:30 +0900 Subject: [PATCH] [enco] frontend/caffe: Introduce GraphBuilderContext (#2529) * [enco] frontend/caffe: Introduce GraphBuilderContext This will introduce GraphBuilderContext to pass information to operator import routines Signed-off-by: SaeHie Park * change include --- contrib/enco/frontend/caffe/src/Context.h | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/contrib/enco/frontend/caffe/src/Context.h b/contrib/enco/frontend/caffe/src/Context.h index 0f8e2d3..aca57ce 100644 --- a/contrib/enco/frontend/caffe/src/Context.h +++ b/contrib/enco/frontend/caffe/src/Context.h @@ -19,6 +19,9 @@ #include +#include +#include + #include #include #include @@ -27,6 +30,10 @@ namespace caffeimport { using LayerName = std::string; +using BlobName = std::string; +// Note: these two maybe evolved to a class +using ShapeContext = std::map; +using StoreContext = std::map; class WeightContext { @@ -68,6 +75,38 @@ private: std::map _data; }; +class GraphBuilderContext +{ +public: + explicit GraphBuilderContext(coco::Module *module, coco::Data *data, coco::Block *block, + ShapeContext &shape_ctx, StoreContext &bag_ctx, + WeightContext &weight_ctx) + : _module(module), _data(data), _block(block), _shape_ctx(shape_ctx), _bag_ctx(bag_ctx), + _weight_ctx(weight_ctx) + { + // DO NOTHING + } + + GraphBuilderContext(const GraphBuilderContext &) = delete; + GraphBuilderContext(GraphBuilderContext &&) = delete; + +public: + coco::Module *module() { return _module; } + coco::Data *data() { return _data; } + coco::Block *block() { return _block; } + ShapeContext &shape_ctx() { return _shape_ctx; } + StoreContext &bag_ctx() { return _bag_ctx; } + WeightContext &weight_ctx() { return _weight_ctx; } + +private: + coco::Module *_module; + coco::Data *_data; + coco::Block *_block; + ShapeContext &_shape_ctx; + StoreContext &_bag_ctx; + WeightContext &_weight_ctx; +}; + } // namespace caffeimport #endif // __CONTEXT_H__ -- 2.7.4