[optimizer] Refactor optimizers accepted/tizen/unified/20210329.145055 submit/tizen/20210326.073159
authorParichay Kapoor <pk.kapoor@samsung.com>
Thu, 18 Mar 2021 11:39:59 +0000 (20:39 +0900)
committerJijoong Moon <jijoong.moon@samsung.com>
Fri, 26 Mar 2021 04:40:44 +0000 (13:40 +0900)
commitaebe92077de0ccf7207637ed6d92e943de413625
treeb19a1ded2408ff9ccc1fee2dd5e3183e9324d151
parent1f966d2c7164c9a8f5c5a1e86c8729f9b526fdcf
[optimizer] Refactor optimizers

refactor optimizers to update to the new design. Now there are
two internal optimizer headers -
1. opitmizer_devel - which is used external of the optimizer. The
interface provided here must be sufficient to use the optimizer by
the models or other classes.
2. optimizer_impl - which also follows the same interface but provides
implementations for some more functions as well as some more member
variables.

optimizer.h in the API is a subset of the optimizer_devel which is the
exposed API for an external user to use.
optimizer_devel.h is the API which a user must implement when creating
their own optimizer.
optimizer_impl.h provides another class which a custom optimizer implementer
can extend for their ease.

These classes follow the below design
optimizer.h (ml::train::Optimizer) <- optimizer_devel.h (nntrainer::Optimizer)
<- optimizer_impl.h (nntrainer::OptimizerImpl)

Further, model, graph, and all other classes contains objects of type nntrainer::Optimizer

The c++ API is also reduced to match with the C API.
Once all the c++ APIs are matched with c API, then we can move more functions
from *_devel.h files to *.h files.

See also #986

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

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
22 files changed:
api/capi/include/nntrainer_internal.h
api/ccapi/include/optimizer.h
debian/nntrainer-dev.install
jni/Android.mk
nntrainer/dataset/databuffer_factory.cpp
nntrainer/layers/activation_layer.cpp
nntrainer/layers/layer.cpp
nntrainer/layers/layer_internal.h
nntrainer/models/model_loader.cpp
nntrainer/models/neuralnet.h
nntrainer/optimizers/adam.cpp
nntrainer/optimizers/adam.h
nntrainer/optimizers/meson.build
nntrainer/optimizers/optimizer_devel.cpp [moved from nntrainer/optimizers/optimizer.cpp with 57% similarity]
nntrainer/optimizers/optimizer_devel.h [moved from nntrainer/optimizers/optimizer_internal.h with 52% similarity]
nntrainer/optimizers/optimizer_factory.h
nntrainer/optimizers/optimizer_impl.cpp [new file with mode: 0644]
nntrainer/optimizers/optimizer_impl.h [new file with mode: 0644]
nntrainer/optimizers/sgd.h
nntrainer/utils/parse_util.cpp
packaging/nntrainer.spec
test/unittest/unittest_nntrainer_appcontext.cpp