platform/core/ml/nntrainer.git
3 years ago[ndk] Add enable profile flag
Jihoon Lee [Mon, 7 Dec 2020 11:31:44 +0000 (20:31 +0900)]
[ndk] Add enable profile flag

This patch add enable profile flag for ndk build for profiling purpose

**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>
3 years ago[Experiment] Add profiler
Jihoon Lee [Fri, 4 Dec 2020 09:29:32 +0000 (18:29 +0900)]
[Experiment] Add profiler

This patch add `enable-profile` option to enable profile. Also this
patch adds a simple profiling logic to `neuralnet::inference`

**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>
3 years ago[Meson] Add ndk-build to be part of ndk build
Jihoon Lee [Thu, 3 Dec 2020 06:38:29 +0000 (15:38 +0900)]
[Meson] Add ndk-build to be part of ndk build

**Changes proposed in this PR:**
- Add option to build library using ndk

**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>
3 years ago[Chores] CustomShortcut bug accepted/tizen/unified/20201207.123248 submit/tizen/20201207.013927
Jihoon Lee [Wed, 2 Dec 2020 10:11:14 +0000 (19:11 +0900)]
[Chores] CustomShortcut bug

As ini format has been changed, ini for customshortcut need change

This patch handles it.

**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>
3 years ago[manager] Share gradient memory for all layer
Parichay Kapoor [Wed, 2 Dec 2020 05:44:26 +0000 (14:44 +0900)]
[manager] Share gradient memory for all layer

This patch allows sharing the memory for gradient across all the layers
The maximum size of the gradient is allocated and all layers have unique tensors
which internally points to this tensor.

This optimization feature can be disabled for a model (as done with automated models unittest)

Manager is also moved to nntrainer/tensor as manager is managing all the weights (tensors) and will
in future manage all the inputs/outputs.
If the functionality of manager is extended, then it can be appropriately moved.

See also #774
Resolves #766

**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>
3 years ago[layers/manager] Register weights with manager
Parichay Kapoor [Wed, 2 Dec 2020 02:52:44 +0000 (11:52 +0900)]
[layers/manager] Register weights with manager

All the weights of the layer are now registered with manager
Manager allocates memory for these weights and in future
handle their updates etc

See also #774 #766

**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>
3 years ago[weight] Updated weights to be vector
Parichay Kapoor [Tue, 1 Dec 2020 12:07:49 +0000 (21:07 +0900)]
[weight] Updated weights to be vector

Updated weights of layer to be vector than a shared_ptr array
This is for easier management and updating weight internally when
gradient will share the memory

See also #774 #766

**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>
3 years ago[manager] Added nntrainer manager for weights
Parichay Kapoor [Tue, 1 Dec 2020 11:14:57 +0000 (20:14 +0900)]
[manager] Added nntrainer manager for weights

Added manager to manage all the allocated weights
This patch also adds manager to the model and passes manager to the
initialize which allows weights to be added to the manager.

**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>
3 years ago[weight/var_grad] Make internal variable as shared_ptr
Parichay Kapoor [Tue, 1 Dec 2020 10:46:38 +0000 (19:46 +0900)]
[weight/var_grad] Make internal variable as shared_ptr

Internal variables in weights/var_grad, namely, the variable and gradient itself
are changed to shared_ptr so that weights can be shared without worrying about
shallow copies.

Also changed the copy constructor to not create new Tensor as copy constructor
of weight will get called and its unnecessary + unintentional overhead.
As weight is just wrapper over tensor, their copy constructors should follow
same behavior as tensor which is to not create new memory.
Added clone as an alternative to create new copy of a given weight.

See also #774 #766

**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>
3 years ago[ CONV2D ] seperate conv2d_gemm and im2col
jijoong.moon [Tue, 1 Dec 2020 04:31:03 +0000 (13:31 +0900)]
[ CONV2D ] seperate conv2d_gemm and im2col

It is better to split conv2d_gemm and im2col

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[unittest] Enable disabled unittest
Parichay Kapoor [Wed, 2 Dec 2020 05:29:19 +0000 (14:29 +0900)]
[unittest] Enable disabled unittest

Enable fc layer disabled unittest

**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>
3 years ago[var_grad] Trainable inferred from gradient submit/tizen/20201201.095355 submit/tizen/20201202.082821
Parichay Kapoor [Tue, 1 Dec 2020 01:48:32 +0000 (10:48 +0900)]
[var_grad] Trainable inferred from gradient

Trainable property of a variable was earlier inferred by storing a trainable variable
Now, trainable will be inferred using gradient.uninitialized()

**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>
3 years ago[tensor] Update tensor operation signature
Parichay Kapoor [Mon, 30 Nov 2020 05:52:20 +0000 (14:52 +0900)]
[tensor] Update tensor operation signature

Update tensor operation signature to return Tensor reference as a retval
than a tensor itself. This avoid creating dummy tensors as a return (which might have been
optimized by the compiler but lets do manually as the input is also a reference).

**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>
3 years ago[CustomLayer] Update readme.md
Jihoon Lee [Mon, 30 Nov 2020 07:34:09 +0000 (16:34 +0900)]
[CustomLayer] Update readme.md

Add readme.md about how to run and expected output

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

Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
3 years ago[Custom] Add actual example
Jihoon Lee [Thu, 26 Nov 2020 07:50:53 +0000 (16:50 +0900)]
[Custom] Add actual example

**Changes proposed in this PR:**
- Add an example to create the custom layer to be used with ini
- Add an example to create the custom layer to be used with api

**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>
3 years ago[Custom] Add an example scaffolding
Jihoon Lee [Wed, 18 Nov 2020 02:30:40 +0000 (11:30 +0900)]
[Custom] Add an example scaffolding

Add a layer example that depends on the user's custom code
This patch generates scaffolding to the `Application/Custom` folder

**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>
3 years ago[ Graph ] remove grad mem buffer for backwarding
jijoong.moon [Fri, 27 Nov 2020 01:12:45 +0000 (10:12 +0900)]
[ Graph ] remove grad mem buffer for backwarding

This PR includes,
  . remove grad memory buffer in n_buffes for graph. We do not need
  this because we could use var memory buffer of n_buffers to
  backwarding.
  . For MNIST, memory consumption is reduced 3.5 to 2.6

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[ModelLoader] Use vector<string> when create layer
Jihoon Lee [Fri, 27 Nov 2020 08:30:47 +0000 (17:30 +0900)]
[ModelLoader] Use vector<string> when create layer

When creating a layer from an ini, enum based properties were used.
This prevents adding a new properties without changing the api header.

This patch moves to setting layer properties to vector<string>
to enable setting properties without changing the api header, eventually
 enabling custom properties in custom layer.

**Semantics Change propesed in this PR**
Ini won't ignore the properties that is not supported since model_loader
would not know if it is supported or not

See also #716

**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>
3 years ago[bnlayer] bug fix for inference
Parichay Kapoor [Wed, 25 Nov 2020 11:45:09 +0000 (20:45 +0900)]
[bnlayer] bug fix for inference

Batch normalization bug fix for inference mode
when add() was used instead of add_i()

**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>
3 years ago[tensor] Support multiply/divide with given output
Parichay Kapoor [Wed, 25 Nov 2020 11:43:11 +0000 (20:43 +0900)]
[tensor] Support multiply/divide with given output

Support multiply/divide with given output tensor
This reduces temporary allocations for bn layer

**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>
3 years ago[pooling] Reduce temporary mem allocations
Parichay Kapoor [Wed, 25 Nov 2020 11:41:54 +0000 (20:41 +0900)]
[pooling] Reduce temporary mem allocations

Reduce temporary memory allocations for pooling
Remove unnecessary temporary memory allocations which can be
replaced with a slice view
Also removed unnecessary setting memory to zero

**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>
3 years ago[activaiton] Reduce temporary memory alloc
Parichay Kapoor [Wed, 25 Nov 2020 11:40:32 +0000 (20:40 +0900)]
[activaiton] Reduce temporary memory alloc

Reduce temporary memory allocations by activation layer
by using the hidden and ret_derivative class variables
This temporarily increases peak memory but alloc-dealloc is removed
from every iteration

**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>
3 years ago[regex] Make regex static const
Parichay Kapoor [Wed, 25 Nov 2020 11:39:27 +0000 (20:39 +0900)]
[regex] Make regex static const

Make regex static const
Although it is using static string, that memory is always being allocated inside regex
Making is static const only makes it once for the function lifetime

**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>
3 years ago[neuralnet] Skip backwarding for non-trainable layers
Parichay Kapoor [Mon, 16 Nov 2020 07:31:00 +0000 (16:31 +0900)]
[neuralnet] Skip backwarding for non-trainable layers

This patch skips the backwarding for the non-trainable layers.
Further, the last trainable layer skips calcDerivative as well.
This results in much fewer calculations as well as more importantly, reduced memory.

See also #732

**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>
3 years ago[Layer] Add built-in ops to the context
Jihoon Lee [Mon, 16 Nov 2020 06:36:49 +0000 (15:36 +0900)]
[Layer] Add built-in ops to the context

**Changes proposed in this PR:**
- Add default layers to the global context

**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>
3 years ago[AppContext] Fix key is case sensitive
Jihoon Lee [Mon, 16 Nov 2020 06:59:20 +0000 (15:59 +0900)]
[AppContext] Fix key is case sensitive

In current semantics, type key should be case insensitive however case
was sensitive, this patch fixes the issue.

**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>
3 years ago[conv2d] More optimizations for conv2d
Parichay Kapoor [Fri, 20 Nov 2020 07:04:49 +0000 (16:04 +0900)]
[conv2d] More optimizations for conv2d

This patch provides more optimizations for conv2d
by avoiding more memcopies and operations along with modification
to internal interface of conv2d_gemm operation

**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>
3 years ago[conv2d] Bug fix for regularization loss
Parichay Kapoor [Fri, 20 Nov 2020 05:46:37 +0000 (14:46 +0900)]
[conv2d] Bug fix for regularization loss

Regularization loss for conv2d layer took average over output filters
than adding it up. This patch fixes it.

See also #761

**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>
3 years ago[conv2d] Refactor conv2d layer
Parichay Kapoor [Fri, 20 Nov 2020 05:37:55 +0000 (14:37 +0900)]
[conv2d] Refactor conv2d layer

Conv2d layer has some issues #761
This patch addresses some of them:
- Weight is now independent of the filter size. Different filter
weights have now been combined. This has resulted in easier addressing of weights
- Above combining of weights also reduced many mem-copies of weights to bring it in a particular shape
- Moved to use getSlice() to get access to some data than creating copies

Now, all layers have fixed number of weights.

**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>
3 years ago[AppContext] Register Default ops at the begining
Jihoon Lee [Fri, 13 Nov 2020 02:51:12 +0000 (11:51 +0900)]
[AppContext] Register Default ops at the begining

**Changes proposed in this PR:**
- Register default optimizer at the beginning of the load

**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>
3 years ago[Deps] Remove openmp dependency
Jihoon Lee [Wed, 18 Nov 2020 02:44:25 +0000 (11:44 +0900)]
[Deps] Remove openmp dependency

Openmp is no longer used. It is deleted to reduce memory consumption

**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>
3 years ago[layers] Split backwarding into smaller functions
Parichay Kapoor [Mon, 16 Nov 2020 07:00:40 +0000 (16:00 +0900)]
[layers] Split backwarding into smaller functions

Split layer backwarding into smaller functions for optimization purposes
- calcDerivative() - calculate the derivative to be passed to previous layers
  this function must be implemented by all derived layers
- calcGradient() - calculate the gradient for the weights of the layer
- applyGradient() - apply the gradients to the weights of the layer

Also, now input->backwarding() throws than just silently not doing anything.

**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>
3 years ago[var_grad] Add var_grad for input/output lists
Parichay Kapoor [Fri, 13 Nov 2020 06:41:08 +0000 (15:41 +0900)]
[var_grad] Add var_grad for input/output lists

Added var_grad for input/output lists which also combines derivatives
This is the baseclass for the weights
This update will help with graph class

**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>
3 years ago[AppContext] Add registerer,invoke factory methods
Jihoon Lee [Wed, 11 Nov 2020 12:30:23 +0000 (21:30 +0900)]
[AppContext] Add registerer,invoke factory methods

**Changes proposed in this PR:**
- Add factory registerer
- Add factory invoker
- Register built-in objects to each layers(postponed)
- Add tests

**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>
3 years ago[ GRAPH ] Remove unused function and add doxygen note accepted/tizen/unified/20201130.122952 submit/tizen/20201127.015104
jijoong.moon [Fri, 20 Nov 2020 07:39:23 +0000 (16:39 +0900)]
[ GRAPH ] Remove unused function and add doxygen note

In neural network class, there is fucntions which should be moved to
graph.
In this PR, remove member functions which is not used any more and add
doxygen comment in graph header.

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[ ANDROID ] Enable graph for andoid build
jijoong.moon [Fri, 20 Nov 2020 06:28:17 +0000 (15:28 +0900)]
[ ANDROID ] Enable graph for andoid build

Fix Android.mk to support graph

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[ GRAPH ] Split initilization & Assign Memory
jijoong.moon [Fri, 20 Nov 2020 05:22:03 +0000 (14:22 +0900)]
[ GRAPH ] Split initilization & Assign Memory

Split ini and mem assignment

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[ NNSTREAMER ] Fix NNStreamer Filter for graph
jijoong.moon [Fri, 20 Nov 2020 02:35:18 +0000 (11:35 +0900)]
[ NNSTREAMER ] Fix NNStreamer Filter for graph

Describe a commit content (Until 80 colums per line) in detail ASAP.

**Changes proposed in this PR:**
- Added TOC generator for README.md

Resolves:

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[ NNSTREAMER FILTER ] Fix nnstreamer filter to support graph
jijoong.moon [Fri, 20 Nov 2020 00:58:43 +0000 (09:58 +0900)]
[ NNSTREAMER FILTER ] Fix nnstreamer filter to support graph

Describe a commit content (Until 80 colums per line) in detail ASAP.

**Changes proposed in this PR:**
- Added TOC generator for README.md

Resolves:

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[ Fix ] istrequal to check length of string
jijoong.moon [Fri, 20 Nov 2020 00:51:04 +0000 (09:51 +0900)]
[ Fix ] istrequal to check length of string

fix istreaqual

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[ GRAPH ] Support Backbone Network
jijoong.moon [Thu, 19 Nov 2020 09:53:31 +0000 (18:53 +0900)]
[ GRAPH ] Support Backbone Network

This PR includes :
 . Modification of Network Graph to enable Backbone network support
 . Fixes for unittest

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[ GRAPH ] Add Compiled Variable
jijoong.moon [Thu, 19 Nov 2020 00:43:17 +0000 (09:43 +0900)]
[ GRAPH ] Add Compiled Variable

- In order to make sure to run initialize after success of compile(),
compiled variable is used.
- additional unittest cases are fixed.

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[ UNITTEST ] Fix unitest & Applications to support NetworkGraph
jijoong.moon [Wed, 18 Nov 2020 07:20:40 +0000 (16:20 +0900)]
[ UNITTEST ] Fix unitest & Applications to support NetworkGraph

Unittest and Applications need to be fixed to support NetworkGraph.

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[ UNIT TEST ] Enable Unit test for graph
jijoong.moon [Tue, 17 Nov 2020 12:19:27 +0000 (21:19 +0900)]
[ UNIT TEST ] Enable Unit test for graph

Because of graph implementation, Unittest must be changed.
In this PR, Enabling Unit Test & Bug Fixes are included.

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[ Graph ] Add Graph into Network
jijoong.moon [Mon, 16 Nov 2020 05:39:57 +0000 (14:39 +0900)]
[ Graph ] Add Graph into Network

Describe a commit content (Until 80 colums per line) in detail ASAP.

**Changes proposed in this PR:**
- Added TOC generator for README.md

Resolves:

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[ Graph ] Modify backwarding/forwarding to use graph data
jijoong.moon [Fri, 13 Nov 2020 02:13:51 +0000 (11:13 +0900)]
[ Graph ] Modify backwarding/forwarding to use graph data

In this PR, Using graph data is eanbled.
 . Each layer use grap data instead of input/hidden tensors.
 . Not any more capy between layers

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[ GRAPH ] Initialize graph
jijoong.moon [Mon, 9 Nov 2020 13:03:39 +0000 (22:03 +0900)]
[ GRAPH ] Initialize graph

This PR includes,
  . Set the Network Buffer
  . Initialize Layer
  . Calculate Dimension
  . Assign Network Buffer at each layer properly

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[ LAYER ] Expose Output Layer
jijoong.moon [Mon, 9 Nov 2020 01:10:01 +0000 (10:10 +0900)]
[ LAYER ] Expose Output Layer

It is not enough to support various connection in network if we
support output layer only in implicitly. This PR includes eanbling
output layer explicitly.

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[ Example ] Mini Resnet
jijoong.moon [Mon, 9 Nov 2020 01:08:06 +0000 (10:08 +0900)]
[ Example ] Mini Resnet

This PR includes,
    . Addintion of Mini Resnet Example to test
    . Skip connection
    . Ouput Layer
    . Addition Layer

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[ Graph ] Neural Network Graph
jijoong.moon [Wed, 21 Oct 2020 02:42:22 +0000 (11:42 +0900)]
[ Graph ] Neural Network Graph

In this PR, NetworkGraph Class is introduced and compile method is
implemented.
During the compile process, it takes layers vector which is created by
model_loader and create required layers like Activation, Flatten,
Concat or Addition Layers. Also it modify inputs relatively and
Calculate the order of calculation. So far, only serial processing is
supported.

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[fc,tensor,adam] Change signature for sum accepted/tizen/unified/20201120.125454 submit/tizen/20201119.063013
Parichay Kapoor [Fri, 13 Nov 2020 13:01:20 +0000 (22:01 +0900)]
[fc,tensor,adam] Change signature for sum

Added new signature for sum
Also removed unnecessary calculation from fc
Optimzed adam calculation to reduce extra memory requirement

**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>
3 years ago[tensor] Reduce overall memory overhead
Parichay Kapoor [Fri, 13 Nov 2020 12:17:56 +0000 (21:17 +0900)]
[tensor] Reduce overall memory overhead

Reduce overall tensor memory overhead
- standardization and normalization now take in-place
- input and label tensor in train are now allocated only once externally and reused for each epoch
that being used in each epoch
- add_i does not allocate new memory now
- removed support for normalization and standardization for conv layer

**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>
3 years ago[ccapi] Direct methods to create layers
Parichay Kapoor [Wed, 11 Nov 2020 10:49:18 +0000 (19:49 +0900)]
[ccapi] Direct methods to create layers

Added syntactic sugar constructors for layers and loss
This allows creating various layers and losses directly with c++ API

**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>
3 years ago[ccapi] Syntactic sugar constructors
Parichay Kapoor [Wed, 11 Nov 2020 07:45:05 +0000 (16:45 +0900)]
[ccapi] Syntactic sugar constructors

Added syntactic sugar constructors for optimizers
which allow making optimizer closer to existing API
and more readable.

See also #734

**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>
3 years ago[tensor] Update tensor signature for apply
Parichay Kapoor [Thu, 12 Nov 2020 11:51:53 +0000 (20:51 +0900)]
[tensor] Update tensor signature for apply

This patch updates tensor signature to include output for apply
Correspondingly, activation layer and loss layer have been updated.

More changes in the patch
- Convolution layer has been updated to reuse its output derivative.
- added a getBatchSlice() which provides a slice of the original tensor by batch
and avoids creating a copy everytime

**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>
3 years ago[tensor] Update tensor op signature for dot
Parichay Kapoor [Thu, 12 Nov 2020 05:23:24 +0000 (14:23 +0900)]
[tensor] Update tensor op signature for dot

Update tensor op signature for dot
Further, fc layer has been updated based on this signature

**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>
3 years ago[Optimizer] Add enum type factory
Jihoon Lee [Wed, 11 Nov 2020 09:43:35 +0000 (18:43 +0900)]
[Optimizer] Add enum type factory

This patch adds integer factory to align with capi

**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>
3 years ago[Model] Apply appcontext
Jihoon Lee [Wed, 11 Nov 2020 02:59:20 +0000 (11:59 +0900)]
[Model] Apply appcontext

Apply appcontext to NeuralNetwork. From this patch `chdir()` hack is not
needed :)

**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>
3 years ago[model] Handle loss layer to be added from user
Parichay Kapoor [Wed, 11 Nov 2020 12:14:25 +0000 (21:14 +0900)]
[model] Handle loss layer to be added from user

Handle loss layer to be added from the user which is created with c++ API

**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>
3 years ago[AppContext] Add AppContext
Jihoon Lee [Mon, 9 Nov 2020 03:16:48 +0000 (12:16 +0900)]
[AppContext] Add AppContext

This patch add basic app context with setting current working directory

**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>
3 years ago[docs] Update docs about backbone features
Parichay Kapoor [Tue, 10 Nov 2020 04:57:47 +0000 (13:57 +0900)]
[docs] Update docs about backbone features

Update documentation for the ini with the newly added backbone features

**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>
3 years ago[backbone/ini] Support subgraph with ini backbone
Parichay Kapoor [Tue, 10 Nov 2020 02:23:27 +0000 (11:23 +0900)]
[backbone/ini] Support subgraph with ini backbone

Added support for subgraph of a given ini backbone
Added corresponding unittests as well

**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>
3 years ago[backbone] Add ini backbone properties
Parichay Kapoor [Mon, 9 Nov 2020 06:21:29 +0000 (15:21 +0900)]
[backbone] Add ini backbone properties

Added ini backbone properties :
- scaleSize - scale the size of the model
- preload - load the weights of this backbone model before adding to the model
preload has issues which requires the format of the model file to update
wait for #361

**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>
3 years ago[Layer] Change layer type to string
Jihoon Lee [Tue, 10 Nov 2020 01:03:00 +0000 (10:03 +0900)]
[Layer] Change layer type to string

This patch changes layer type to string

**Changes proposed in this PR:**
- Add Layer::getType() and Layer::type
- Add `istrequal` to the `parse_util` for case insensitive compare
- Test changes accordingly

**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>
3 years agoUpdate README.md
Mete Ozay [Wed, 11 Nov 2020 12:05:19 +0000 (12:05 +0000)]
Update README.md

- Update links to examples
- Update Getting Started and Running Examples
- Fix grammar and typo.

Signed-off-by: Mete Ozay <meteozay@gmail.com>
3 years ago[nnstreamer/backbone] Update to support more backbone
Parichay Kapoor [Wed, 4 Nov 2020 04:00:11 +0000 (13:00 +0900)]
[nnstreamer/backbone] Update to support more backbone

Update nnstreamer backbone layer to support more backbones than just tflite
Wait for this PR to merge till the bug fix on nnstreamer
https://github.com/nnstreamer/nnstreamer/pull/2850 is merged and reflected

**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>
3 years ago[cifar] Update cifar application with backbone
Parichay Kapoor [Tue, 10 Nov 2020 12:23:15 +0000 (21:23 +0900)]
[cifar] Update cifar application with backbone

Update cifar application using databuffer with generator to
use tflite backbone.

**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>
3 years ago[Optimizer] Change enum type to string
Jihoon Lee [Thu, 5 Nov 2020 10:48:24 +0000 (19:48 +0900)]
[Optimizer] Change enum type to string

Change optimizer type to string

**Changes proposed in this PR:**
- Bullet points are okay, too

**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>
3 years ago[Fix] Throw when read/save fails
Jihoon Lee [Fri, 6 Nov 2020 05:55:36 +0000 (14:55 +0900)]
[Fix] Throw when read/save fails

Currently, read save didn't throw when failing on those operation.
From this patch, if an object fails to read, it throws an exception
to preven false positive on test result

**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>
3 years ago[Test] Add conv2d Integrated test
Jihoon Lee [Wed, 4 Nov 2020 11:31:03 +0000 (20:31 +0900)]
[Test] Add conv2d Integrated test

This patch add conv2d integrated test

Model test passes, layer test failes due to bug fix

**Changes proposed in this PR:**
- add conv2d integrated test/generator
- add transLayer for channelfirst <-> channel last conversion

**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>
3 years ago[Conv] Fix convlayer backwarding
Jihoon Lee [Wed, 4 Nov 2020 11:25:26 +0000 (20:25 +0900)]
[Conv] Fix convlayer backwarding

There was missed calculation doing conv2d backwarding.

This patch fixes the issue.

With this patch, some test fails. I'll take a look and fix accordingly
within this commit

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

Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
3 years ago[ POOLING ] Fix global pooling dimensions
jijoong.moon [Mon, 9 Nov 2020 13:01:40 +0000 (22:01 +0900)]
[ POOLING ] Fix global pooling dimensions

For the global pooling, we need to set the output dimension on last
dimension, width.

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[backbone] Documentation for backbone
Parichay Kapoor [Fri, 6 Nov 2020 04:41:32 +0000 (13:41 +0900)]
[backbone] Documentation for backbone

Added documentation for backbone in ini-configuration

**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>
3 years ago[ Layer ] Add Output Layer to support multiple output
jijoong.moon [Thu, 5 Nov 2020 12:39:20 +0000 (21:39 +0900)]
[ Layer ] Add Output Layer to support multiple output

Currently there is no way to support multiple output.
However it is not neccessary to be explicit support.
Instead if user use "output_layers = layername0, layername1", then nntrainer
automatically add output layer. ( comparing ouput dimension and input
layer's dimension, we could decide it is addition or split operation. )

Also, if certain layer is specify as an input layer from mutiple
layers, then it should be added implicitly.

TODO: support split operation

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[README] Modify the image url
hyeonseok lee [Fri, 6 Nov 2020 06:21:18 +0000 (15:21 +0900)]
[README] Modify the image url

Modify the url from absolute path to relative path

Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
3 years ago[bn layer] Support non-trainable mode
Parichay Kapoor [Thu, 5 Nov 2020 04:55:13 +0000 (13:55 +0900)]
[bn layer] Support non-trainable mode

Support non-trainable mode for bn layer when the parameters
for this layer are not updated.

**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>
3 years ago[Test/Py] Add translayer
Jihoon Lee [Mon, 2 Nov 2020 11:21:09 +0000 (20:21 +0900)]
[Test/Py] Add translayer

Add `translayer` to encapsulate keras layer to use nntrainer layout
This can be used for `genInput.py` as well.

**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>
3 years ago[ Util ] Add how to generate cifar 10/100 bmp images
jijoong.moon [Fri, 6 Nov 2020 02:59:07 +0000 (11:59 +0900)]
[ Util ] Add how to generate cifar 10/100 bmp images

Add document explain how to generate cifar 10/100 bmp images

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[README] Bugfix for image display
Parichay Kapoor [Fri, 6 Nov 2020 02:28:09 +0000 (11:28 +0900)]
[README] Bugfix for image display

Add bugfix for readme where images were not being shown

**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>
3 years ago[debian/dist] Updated debian packaging of files
Parichay Kapoor [Wed, 4 Nov 2020 02:27:53 +0000 (11:27 +0900)]
[debian/dist] Updated debian packaging of files

Updated debian packaging to limit the files which are packaged and exposed.

**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>
3 years ago[restructure] Restructure the core files
Parichay Kapoor [Wed, 4 Nov 2020 02:25:58 +0000 (11:25 +0900)]
[restructure] Restructure the core files

This patch restructures the internal files
include and src folders are replaced with more relevant and clustered folders
headers and souces now live together

Also the headers exposed in the packaging are severely limited than exposing
all the headers. Updated for Android and Tizen packaging as well.

**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>
3 years ago[Delegate] Add delegate support header
Parichay Kapoor [Fri, 7 Aug 2020 08:00:19 +0000 (17:00 +0900)]
[Delegate] Add delegate support header

Add delegate support header
This supports settings backend and device
Added some properties but they are experimental

**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>
3 years agoUpdate application to use backbone
Parichay Kapoor [Thu, 29 Oct 2020 06:38:39 +0000 (15:38 +0900)]
Update application to use backbone

Update transfer learning application to use backbone
Now feature extractor has been removed from the application
and dependency on tflite is also removed

However, the caching of features from feature extractor is not yet supported.
This results in the application to be slow to run full 1000 epochs on gbs
Till caching is supported, application test from gbs build is removed

Also fixed android packaging for nntrainer with tflite and KNN application

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
3 years ago[backbone] Added native support for tflite backbone
Parichay Kapoor [Tue, 3 Nov 2020 10:03:42 +0000 (19:03 +0900)]
[backbone] Added native support for tflite backbone

Added native support for tflite backbone
The unittests are verified for tflite backbone as tflite backbone
is preferred over nnstreamer backbone.
Interfacing directly with tflite API allows directly using tensor memory
for forwarding, avoid memcpy incurred with nnstreamer backbone.

TfLite takes input shape of format NHWC.
However, nntrainer takes the shape NCHW.
This will be resolved later with a transpose operator later.

**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>
3 years ago[ Layer ] Add input_layers keyword
jijoong.moon [Thu, 29 Oct 2020 07:10:55 +0000 (16:10 +0900)]
[ Layer ] Add input_layers keyword

This PR includes enabling 'input_layers' keyword.
With this keyword, we could specify layer's input tensor.

. Added skip in parse_util to remove space and '[',']' in string and
split with ',' delimiter.

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[backbone] unittest for external backbone
Parichay Kapoor [Thu, 29 Oct 2020 06:35:14 +0000 (15:35 +0900)]
[backbone] unittest for external backbone

Added support for external backbone
Also added a small add.tflite file for unittests
trainable is not supported with external backbones for now
Added tizen packaging and other unittest fixes

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
3 years ago[backbone] Support for external backbone
Parichay Kapoor [Thu, 29 Oct 2020 06:32:42 +0000 (15:32 +0900)]
[backbone] Support for external backbone

Added support for external backbone with nnstreamer
This is enabled for both ubuntu and Tizen
This patch creates a nnstreamer layer to support running different kind of model files
with nnstreamer single c-api

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
3 years agoAdd github account on README.md file
hyeonseok lee [Wed, 4 Nov 2020 06:54:48 +0000 (15:54 +0900)]
Add github account on README.md file

Add my github account on README.md file

Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
3 years ago[IntegratedTest] Add batch normalization test
Jihoon Lee [Wed, 28 Oct 2020 11:42:37 +0000 (20:42 +0900)]
[IntegratedTest] Add batch normalization test

Add test that using batchnormalization with a minor structural change on
the tester

**Changes proposed in this PR for tester:**
- Implement reorder logic for bn layer in `recorder.py`
- Add color to some debug prints
- Let layer update inside actual `backwarding`
- save weights including non_trainable but save gradients only for the
trainables

**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>
3 years ago[Test/Util] Update ini / debug info
Jihoon Lee [Wed, 28 Oct 2020 06:44:10 +0000 (15:44 +0900)]
[Test/Util] Update ini / debug info

**Changes proposed in this PR:**
- Add some helperfunction to iniTestWrapper
- Add color and adam debug info to recorder.py

**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>
3 years ago[concat] Move validity checks to init
Parichay Kapoor [Tue, 3 Nov 2020 04:33:05 +0000 (13:33 +0900)]
[concat] Move validity checks to init

Move the dimension checks for validity of the various inputs
for concat layer are moved to initialize().
They are kept back in forwarding() under DEBUG conditional.

**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>
3 years ago[tensorfilter] Bug fix of tranpose
Parichay Kapoor [Tue, 3 Nov 2020 13:07:44 +0000 (22:07 +0900)]
[tensorfilter] Bug fix of tranpose

nntrainer takes data of NCHW
however, nnstreamer's tensor_converter produces data of format NHWC.
Existing implementation transposed the dimensions to match to NCHW format
However, the data was not transposed.
The unittest passed because the channel was just 1 which does not require
transpose on data side.

This patch removes the transpose of dimension from the nntrainer tensor_filter
and the transpose is done properly in the pipeline with nnstreamer's tensor_transform

v2:
Update transfer learning application which uses the pipeline.

v3:
Updated customshortcut application

Resolves #695

**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>
3 years agoTroubleshooting installation process with observed errors and working solutions
Mete Ozay [Tue, 3 Nov 2020 07:53:36 +0000 (07:53 +0000)]
Troubleshooting installation process with observed errors and working solutions

Signed-off-by: Mete Ozay <meteozay@gmail.com>
Troubleshooting installation process with observed errors and working solutions

3 years ago[Fix/test] Fix adam iteration start to 1
Jihoon Lee [Wed, 28 Oct 2020 05:23:47 +0000 (14:23 +0900)]
[Fix/test] Fix adam iteration start to 1

Fix bug that epoch_idx is not saved for continue_train
Fix iteration to start from 0 in model test

**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>
3 years ago[ Layer ] Add Concat Layer
jijoong.moon [Tue, 27 Oct 2020 04:51:00 +0000 (13:51 +0900)]
[ Layer ] Add Concat Layer

This PR includes Concatenate layer.

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
3 years ago[Test] Refactor recorder.py
Jihoon Lee [Fri, 23 Oct 2020 06:36:39 +0000 (15:36 +0900)]
[Test] Refactor recorder.py

This commit mainly patches KerasRecorder to be more flexible

**Changes proposed in this PR:**
- Pass file, label info at `KerasRecorder.run` phase instead of __init__
to leave room to reuse the model
- Allow initiation with SequentialModel for usuability
- Deal with cross_sigmoid, cross_softmax
- Move some functions out of class

**V2**
Since `KerasRecorder` class was highly coupled to a certain model and
made it hard to make some variation out of it, (e.g. using "mse" instead
of "cross" will need to make a whole new class and it is much
error-prone.
This patch move the class implementation to several functions.

This will be used with `functools.partial` so to easily generate loss,
optimizer variation.

**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>
[Test/Refactor] Restructure data format

Restructure golden data to reduce redundant data and only check updated
weight thus making code more readable

**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>
3 years ago[Fix/bn] Fix batchnormalize layer
Jihoon Lee [Wed, 28 Oct 2020 11:07:35 +0000 (20:07 +0900)]
[Fix/bn] Fix batchnormalize layer

Fix batchnormalizationLayer that epsilon is included toward saving
moving variacne that could lead to long term inaccuracy

**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>
3 years ago[Fix/Optimizer] Fix decay_rate application
Jihoon Lee [Wed, 28 Oct 2020 04:56:11 +0000 (13:56 +0900)]
[Fix/Optimizer] Fix decay_rate application

There was a bug that decay_rate were always applied when it is set to
default value. Becuase `decay_steps != -1` was evaluated to true.

This patch fixes the issue.

**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>
3 years ago[backbone] Add trainable feature to backbone
Parichay Kapoor [Fri, 23 Oct 2020 06:00:51 +0000 (15:00 +0900)]
[backbone] Add trainable feature to backbone

This patch adds supporting training feature to backbone
Corresponding unittests are also added

**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>
3 years ago[ Layer ] Multiple Input Dimensions
jijoong.moon [Tue, 27 Oct 2020 11:01:52 +0000 (20:01 +0900)]
[ Layer ] Multiple Input Dimensions

Current implementaion only take one input. In order to take multiple
input, input_dim / output_dim should be vector type.
This PR includes this fixes except about addition layer which requires
actual multiple input. This will be done consequtive PR.

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

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>