[optimizer] Refactor optimizer
authorParichay Kapoor <pk.kapoor@samsung.com>
Thu, 8 Oct 2020 06:42:32 +0000 (15:42 +0900)
committerJijoong Moon <jijoong.moon@samsung.com>
Tue, 13 Oct 2020 03:16:18 +0000 (12:16 +0900)
commit80834f3aed1f93c1d7f9960be3159c61acadb299
treeb3dddb243d66c07edc697f3ee6f0be1733e9efb9
parent6bb5877c300167079d9e6d917caa9ccabd891c22
[optimizer] Refactor optimizer

This patch refactors optimizer in the following fashion:
- split optimizer implementations of different types to derived classes of adam and sgd
- create a optimizer_factory to create the optimizer class objs based on its type
  - this can be directly used with ccapi
- OptParam struct has been removed
- applyGradients has been broken down into different methods
- updated associated unittests

**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>
33 files changed:
api/capi/src/nntrainer.cpp
jni/Android.mk
nntrainer/include/activation_layer.h
nntrainer/include/adam.h [new file with mode: 0644]
nntrainer/include/addition_layer.h
nntrainer/include/flatten_layer.h
nntrainer/include/input_layer.h
nntrainer/include/layer.h
nntrainer/include/neuralnet.h
nntrainer/include/optimizer.h
nntrainer/include/optimizer_factory.h [new file with mode: 0644]
nntrainer/include/sgd.h [new file with mode: 0644]
nntrainer/include/weight.h
nntrainer/meson.build
nntrainer/src/activation_layer.cpp
nntrainer/src/adam.cpp [new file with mode: 0644]
nntrainer/src/addition_layer.cpp
nntrainer/src/bn_layer.cpp
nntrainer/src/conv2d_layer.cpp
nntrainer/src/fc_layer.cpp
nntrainer/src/flatten_layer.cpp
nntrainer/src/input_layer.cpp
nntrainer/src/layer.cpp
nntrainer/src/loss_layer.cpp
nntrainer/src/model_loader.cpp
nntrainer/src/neuralnet.cpp
nntrainer/src/optimizer.cpp
nntrainer/src/optimizer_factory.cpp [new file with mode: 0644]
nntrainer/src/pooling2d_layer.cpp
nntrainer/src/sgd.cpp [new file with mode: 0644]
packaging/nntrainer.spec
test/unittest/unittest_nntrainer_internal.cpp
test/unittest/unittest_nntrainer_layers.cpp