[LayerNode] Change context to be RAII
authorJihoon Lee <jhoon.it.lee@samsung.com>
Mon, 6 Sep 2021 08:49:02 +0000 (17:49 +0900)
committerJijoong Moon <jijoong.moon@samsung.com>
Thu, 9 Sep 2021 05:03:05 +0000 (14:03 +0900)
commitaeaa3c38fda612f0495d5b8c0eb8660f76ba65f7
treecb04ec8f6baec6b034163d2b2ac3fef2a8d00899
parent4029a3fc1d7e9b8fb66702d286101e5a725eeb73
[LayerNode] Change context to be RAII

This patch refactors context to be RAII to make layer node properties
dumb.

**Changes**
- init context is removed
   - layer node instead created and returned from layerNode::finalize(input_dims)
   - remove dependency to input dimension before initialize
   - layerNode now has input_shapes instead of setting directly from initContext
   - runcontext is used to query things
   - fix multiple bugs regarding the validity of layer node

- networkGraph::updateRunContext() -> finalizeContext() now
finalizes inside this function for brevity
- layerNode::updateRunContext() -> configureContext() to make it RAIIer.
- minor code cleans in networkGraph::initialize

**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
Applications/Custom/LayerPlugin/layer_plugin_common_test.cpp
nntrainer/graph/network_graph.cpp
nntrainer/graph/network_graph.h
nntrainer/layers/layer_context.cpp
nntrainer/layers/layer_context.h
nntrainer/layers/layer_node.cpp
nntrainer/layers/layer_node.h
nntrainer/layers/time_dist.cpp
test/unittest/layers/layers_dependent_common_tests.cpp