platform/core/ml/nntrainer.git
2 years ago[layer] Performance optimizations to LSTMCell
Parichay Kapoor [Wed, 27 Oct 2021 11:54:45 +0000 (20:54 +0900)]
[layer] Performance optimizations to LSTMCell

Add minor performance optimizations to LSTMCell.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[tensor] Add beta for tensor sum
Parichay Kapoor [Wed, 27 Oct 2021 11:36:01 +0000 (20:36 +0900)]
[tensor] Add beta for tensor sum

Add beta for tensor to enable addition to existing tensor while summing.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[API/trivial] Add LSTMCell creator
Jihoon Lee [Wed, 27 Oct 2021 02:59:03 +0000 (11:59 +0900)]
[API/trivial] Add LSTMCell creator

This patch add lstm cell creator

**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>
2 years ago[layer] override setBatch in bn layer
hyeonseok lee [Tue, 26 Oct 2021 08:44:17 +0000 (17:44 +0900)]
[layer] override setBatch in bn layer

 - Override setBatch function

Self evaluation:

Build test: [X]Passed [ ]Failed [ ]Skipped
Run test: [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
2 years ago[layer] LSTM cell batchresize bug fix
Parichay Kapoor [Tue, 26 Oct 2021 07:06:11 +0000 (16:06 +0900)]
[layer] LSTM cell batchresize bug fix

As LSTM cell uses the batch values not in the batch dimension but in the
inner dimension, it creates bug with the existing layer context interface
as it only allows updating the batch along the batch dimension.
This patch provides a quick fix to combine the time and batch values in
the batch dimension.

Once recurrent realizer allows multiple inputs, the time factor will be
removed and the reshapes can be removed.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[layer] Optimization for LSTM cell
Parichay Kapoor [Tue, 26 Oct 2021 06:31:20 +0000 (15:31 +0900)]
[layer] Optimization for LSTM cell

Optimization for LSTM cell to combine the activation function running on
the values.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[Android] Add missing fopenmp
Jihoon Lee [Tue, 26 Oct 2021 01:18:29 +0000 (10:18 +0900)]
[Android] Add missing fopenmp

This patch add missing fopenmp.

**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>
2 years ago[Android] Enable test for the android build
Jihoon Lee [Fri, 22 Oct 2021 14:41:02 +0000 (23:41 +0900)]
[Android] Enable test for the android build

This patch enable android build, this abling this option has an 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>
2 years ago[Android] Unlink ml-api-inference module
Jihoon Lee [Fri, 22 Oct 2021 13:17:25 +0000 (22:17 +0900)]
[Android] Unlink ml-api-inference module

This patch unlink ml-api-inference module as it requires gstreamer

**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>
2 years ago[Fix/pkgconfig] Fix nntrainer include dir
Jihoon Lee [Tue, 26 Oct 2021 05:19:15 +0000 (14:19 +0900)]
[Fix/pkgconfig] Fix nntrainer include dir

This patch fixes pkg config nntrainer include directory for the pkg.

**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>
2 years ago[LSTMCELL] Fix compile error
Jihoon Lee [Tue, 26 Oct 2021 01:22:03 +0000 (10:22 +0900)]
[LSTMCELL] Fix compile error

This patch fix compile error in the main branch

**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>
2 years ago[layer] Bug fix for LSTMCell
Parichay Kapoor [Mon, 25 Oct 2021 01:29:50 +0000 (10:29 +0900)]
[layer] Bug fix for LSTMCell

Enable recurrent unrolling tests for LSTMCell with a single and stacked
LSTM cell. Add corresponding bug fixes.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[layer] Add first draft of lstm cell
Parichay Kapoor [Sat, 23 Oct 2021 13:18:51 +0000 (22:18 +0900)]
[layer] Add first draft of lstm cell

This patch adds the first draft of lstm cell. This has certain
advantages over the existing LSTM when executing for single timestep:
- does not need to divide the data over smaller chunks for computation.
This saves the overhead of creating tensors, an extra loop and combines
computation to a single call for efficiency.
- some of the operations have been avoided based on the current timestep
(which were zeros).
More optimizatios will be coming soon for LSTM cell.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[tensor] Add support for strided operators
Parichay Kapoor [Sat, 23 Oct 2021 13:16:21 +0000 (22:16 +0900)]
[tensor] Add support for strided operators

This patch adds support for strided multiply, apply and getSharedDataTensor
operations for tesnor.
Later these will be optimized direct data access with an iterator.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[Android] disable nnstreamer layer
Jihoon Lee [Fri, 22 Oct 2021 12:22:53 +0000 (21:22 +0900)]
[Android] disable nnstreamer layer

This patch disables nnstreamer backbone because of the package issue for
android build

**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>
2 years ago[Clean] remove enable-android option
Jihoon Lee [Fri, 22 Oct 2021 10:24:15 +0000 (19:24 +0900)]
[Clean] remove enable-android option

This patch remove enable-android for brevity

**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>
2 years ago[Android] Add prebuilt android for the built library
Jihoon Lee [Fri, 22 Oct 2021 10:22:51 +0000 (19:22 +0900)]
[Android] Add prebuilt android for the built library

This patch provides prebuilt android when making android zip file

**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>
2 years ago[Android] Add simple package script
Jihoon Lee [Fri, 22 Oct 2021 10:11:07 +0000 (19:11 +0900)]
[Android] Add simple package script

This patch adds android simple package script to make tar.gz

**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>
2 years ago[Fix] fix bug for install_headers
Jihoon Lee [Fri, 22 Oct 2021 10:10:17 +0000 (19:10 +0900)]
[Fix] fix bug for install_headers

Fix bug that install_headers install_dir overrides subdir props.
This is undocumented behavior so changed to make it to be deterministic

**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>
2 years ago[Android] Set up install directory for android build
Jihoon Lee [Fri, 22 Oct 2021 09:36:06 +0000 (18:36 +0900)]
[Android] Set up install directory for android build

This patch sets up install directory for android build.

It is defaulted to installed in the meson.build_root() /
android_build_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>
2 years ago[Android] Enable capi/ccapi build
Jihoon Lee [Fri, 22 Oct 2021 08:54:29 +0000 (17:54 +0900)]
[Android] Enable capi/ccapi build

This patch enable capi/ccapi build

**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>
2 years ago[Meson] Add android nntrainer build
Jihoon Lee [Fri, 22 Oct 2021 08:01:55 +0000 (17:01 +0900)]
[Meson] Add android nntrainer build

This patch add android meson build.
which can be triggered by ninja

**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>
2 years ago[Meson] Save and apply extra defines
Jihoon Lee [Fri, 22 Oct 2021 06:48:58 +0000 (15:48 +0900)]
[Meson] Save and apply extra defines

This patch saves extra defines as a list to be applied for the android
build 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>
2 years ago[Android] disable building src through ninja
Jihoon Lee [Fri, 22 Oct 2021 05:19:23 +0000 (14:19 +0900)]
[Android] disable building src through ninja

This patch disables building src through ninja for android

**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>
2 years ago[android] Add platform android and install deps
Jihoon Lee [Fri, 22 Oct 2021 03:37:10 +0000 (12:37 +0900)]
[android] Add platform android and install deps

This patch add platform android and install deps according to 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>
2 years ago[TRIVIAL] Fix error log
Jihoon Lee [Thu, 21 Oct 2021 07:34:06 +0000 (16:34 +0900)]
[TRIVIAL] Fix error log

error log string was concated by '+' which was invalid

**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>
2 years ago[Android] Remove bfd linker
Jihoon Lee [Thu, 21 Oct 2021 06:54:59 +0000 (15:54 +0900)]
[Android] Remove bfd linker

bfd linker is deprecated so it's also deleted from android build

**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>
2 years ago[Trivial] Add override to functions
Jihoon Lee [Thu, 21 Oct 2021 05:53:45 +0000 (14:53 +0900)]
[Trivial] Add override to functions

This patch add override to virtual functions mainly to suppress compile
warnings from android build

**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>
2 years ago[Optimizer] Prevent weight allocation for dependent nodes
Jihoon Lee [Mon, 25 Oct 2021 09:26:37 +0000 (18:26 +0900)]
[Optimizer] Prevent weight allocation for dependent nodes

This patch prevents optimizer weight allocation for dependent nodes

Resolves #1671

**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>
2 years ago[build] Add openmp dependency for improved performance
Parichay Kapoor [Fri, 22 Oct 2021 07:25:08 +0000 (16:25 +0900)]
[build] Add openmp dependency for improved performance

This patch adds openmp dependency while building for improved
performance.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[tensor] Bug fix for dropout mask generation
Parichay Kapoor [Fri, 22 Oct 2021 06:59:48 +0000 (15:59 +0900)]
[tensor] Bug fix for dropout mask generation

This patch adds fix for dropout mask generation. It was being
out-of-place which was leading to not using the tensor memory already
allocated. This patch adds the interface to use the already allocated
tensor and use it.
This patch further saves memory while generating dropout mask itself as
well.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[SVACE] Fix init problem
Jihoon Lee [Thu, 21 Oct 2021 07:55:15 +0000 (16:55 +0900)]
[SVACE] Fix init problem

This patch fixes initiation problem

**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>
2 years ago[mem-opt] Add script to memory peak RSS memory
Parichay Kapoor [Mon, 13 Sep 2021 07:09:51 +0000 (16:09 +0900)]
[mem-opt] Add script to memory peak RSS memory

This patch adds a script to measure the peak RSS memory.
To check the memory consumption, pass the command to run the
applicaiton/test to this script.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[Fix] not used variable
Jihoon Lee [Thu, 21 Oct 2021 05:38:13 +0000 (14:38 +0900)]
[Fix] not used variable

Not used variable is deleted from static analyzer

**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>
2 years ago[Fix] Svace issue
Jihoon Lee [Thu, 21 Oct 2021 05:36:18 +0000 (14:36 +0900)]
[Fix] Svace issue

Fix uinit ctor

**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>
2 years ago[Concat] Add axis selection
Jihoon Lee [Wed, 20 Oct 2021 13:37:13 +0000 (22:37 +0900)]
[Concat] Add axis selection

Add axis selction mechanism if axis is not specified that if height
exist, concat to the width dimension

**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>
2 years ago[Reshape] Add exportTo
Jihoon Lee [Wed, 20 Oct 2021 13:36:51 +0000 (22:36 +0900)]
[Reshape] Add exportTo

This patch implements exportTo to reshape

**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>
2 years ago[Fix] fix validate Input
Jihoon Lee [Wed, 20 Oct 2021 12:33:55 +0000 (21:33 +0900)]
[Fix] fix validate Input

This patch fixes validate Input

**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>
2 years ago[test/bn1d] Add bn1d support
Jihoon Lee [Thu, 21 Oct 2021 03:54:23 +0000 (12:54 +0900)]
[test/bn1d] Add bn1d support

This patch adds bn1d support for the transLayer_v2

**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>
2 years ago[Fix] fix recorder registration
Jihoon Lee [Wed, 20 Oct 2021 12:21:12 +0000 (21:21 +0900)]
[Fix] fix recorder registration

This patch fix registration bug when there is more than two overloaded
delgation

**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>
2 years ago[Fix] Layer node clone configuration
Jihoon Lee [Wed, 20 Oct 2021 12:20:26 +0000 (21:20 +0900)]
[Fix] Layer node clone configuration

layer node clone configuration was not copying realization, this is
fixed with this patch

**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>
2 years ago[layer] Create property for axis in batch normalization
Parichay Kapoor [Wed, 20 Oct 2021 05:49:32 +0000 (14:49 +0900)]
[layer] Create property for axis in batch normalization

This patch convert the axis member in batch normalization to a property
to allow setting it externally.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[profile] Support profiling by layer type
Parichay Kapoor [Tue, 19 Oct 2021 10:52:24 +0000 (19:52 +0900)]
[profile] Support profiling by layer type

This patch adds support for profiling of the model based on the type of
the layers.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[network/neuralnet] Move backwarding to network
Parichay Kapoor [Tue, 19 Oct 2021 10:10:40 +0000 (19:10 +0900)]
[network/neuralnet] Move backwarding to network

The iteration of the graph to perform the backwarding has been moved to
the network graph in this patch.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[layer] Support concat along all the dimensions
Parichay Kapoor [Wed, 20 Oct 2021 04:54:42 +0000 (13:54 +0900)]
[layer] Support concat along all the dimensions

This patch provides support for the concat layer among all the
dimensions. Other changes include:
- split_dimension property keyword has been changed to axis and reused
for concat_dimension
- TensorDim::getNumDim() is now a static function

Corresponding unittests for the concat layer are also added.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[Test] Add recurrent value compare tests
Jihoon Lee [Tue, 19 Oct 2021 11:19:01 +0000 (20:19 +0900)]
[Test] Add recurrent value compare tests

This patch adds recurrent value compares golden tests

There are 4 cases presented.

1. single fc recurrent
2. stacked fc recurrent
3. single lstm recurrent
4. stacked lstm recurrent

**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>
2 years ago[LSTM] Fix single time step backwarding
Jihoon Lee [Tue, 19 Oct 2021 10:03:30 +0000 (19:03 +0900)]
[LSTM] Fix single time step backwarding

This patch updates single time step backwarding to properly set and see
the last timestep values

**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>
2 years ago[Test] Add model v2 test generator
Jihoon Lee [Tue, 19 Oct 2021 10:00:56 +0000 (19:00 +0900)]
[Test] Add model v2 test generator

This patch add model v2 test generator using pytorch.

**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>
2 years ago[Test] Connect v2 test to the parameterized test
Jihoon Lee [Tue, 19 Oct 2021 08:39:59 +0000 (17:39 +0900)]
[Test] Connect v2 test to the parameterized test

This patch connect v2 test to the model param test for convenience

+ add validateFor_v2. This is separated out because label dimension is
not given, although it should be merged to validateFor

**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>
2 years ago[Test] Add models v2 test
Jihoon Lee [Tue, 19 Oct 2021 08:32:39 +0000 (17:32 +0900)]
[Test] Add models v2 test

This patch proposes models v2 test which is much lighter.

**Purpose**
1. Lighter model test as layer golden test compensates for it.
2. Easier debugging especially by checking offset, and moving metatdat
3. Give greater flexibility to the golden test generator on the model
architecture
4. Not saving golden file but making it on the fly on the builder side

**Major Difference**
1. Gradient comparison is skipped as it is automatically checked at the
next iteration.
2. Add metadata about num_iterations to file
3. Add size check while reading the golden file
4. Delete redundant information that can be infered.
5. Every iteration has it's own input information.

**Golden Format**
```
    ## file format is as below
    # [<number of iteration(int)> <Iteration> <Iteration>...<Iteration>]
    # Each iteration contains
    # [<input(Tensors)><Label(Tensors)><Parameters(Tensors)><Output(Tensors)>]
    # Each tensor contains
    # [<num_elements(int32)><data_point(float32)>...<data_point(float32)>]
```

**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>
2 years ago[Trivial] Open sizeCheckedReadTensor to util
Jihoon Lee [Tue, 19 Oct 2021 08:29:15 +0000 (17:29 +0900)]
[Trivial] Open sizeCheckedReadTensor to util

This patch opens sizeCheckedReadTensor to util for the later use

**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>
2 years ago[Fix/Sharing] Fix gradient updation log
Jihoon Lee [Tue, 19 Oct 2021 08:20:00 +0000 (17:20 +0900)]
[Fix/Sharing] Fix gradient updation log

Gradient should be initialized at the very first (backward) access, but the
shared weight was updated at the very last (backward) access, this patch
resolves the issue by adding isFirstAccess to the var_grad.h

**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>
2 years ago[layer] Support reshape layer
Parichay Kapoor [Tue, 19 Oct 2021 07:10:44 +0000 (16:10 +0900)]
[layer] Support reshape layer

This patch provides support for reshape layer and basic unittests.
The flatten layer is also updated to use reshape layer internally.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[test] GRU with reset_after=False
Parichay Kapoor [Tue, 19 Oct 2021 05:14:54 +0000 (14:14 +0900)]
[test] GRU with reset_after=False

GRU matches with tf1 but not with tf2.
Tf2 changes the reset_after to True as default, which leads to an extra
bias. This patch forces the reset_after to be always false to enable
matching with tf1 and tf2.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[tensor] Add checks for external tensors
Parichay Kapoor [Tue, 19 Oct 2021 02:40:52 +0000 (11:40 +0900)]
[tensor] Add checks for external tensors

This patch adds checks while setting the external tensors:
- ensure that the external tensor size is more than the required memory
- if the tensor size is 0, its data must be null

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[layer/test] Add unittests for conv1d
Parichay Kapoor [Mon, 18 Oct 2021 08:32:46 +0000 (17:32 +0900)]
[layer/test] Add unittests for conv1d

This patch adds layers golden tests for conv1d.
conv1d is also added to the list of transpose layers while saving data
from tensorflow.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[layer] Add conv1d implementation
Parichay Kapoor [Mon, 18 Oct 2021 08:30:36 +0000 (17:30 +0900)]
[layer] Add conv1d implementation

This patch adds conv1d implementation support.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[properties] Bug fix for padding compute
Parichay Kapoor [Mon, 18 Oct 2021 08:28:45 +0000 (17:28 +0900)]
[properties] Bug fix for padding compute

This patch provides bug fix for padding compute in the usage of stride.
The stride along width and height were being used wrongly.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[LSTM] Add lstm fix and test run
Jihoon Lee [Mon, 18 Oct 2021 02:21:48 +0000 (11:21 +0900)]
[LSTM] Add lstm fix and test run

This patch add lstm fix and test run.

**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>
2 years ago[Neuralnet] Add debug mode to check optimizer
Jihoon Lee [Fri, 15 Oct 2021 09:24:42 +0000 (18:24 +0900)]
[Neuralnet] Add debug mode to check optimizer

This patch add debug mode to check optimizer

**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>
2 years ago[Fix] tensor pool prerequest bug
Jihoon Lee [Fri, 15 Oct 2021 09:23:51 +0000 (18:23 +0900)]
[Fix] tensor pool prerequest bug

This patch fix tensor pool prereuqestedrequest bug by that shared_name
was wrong

**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>
2 years ago[Trivial] Move makeGraph function out
Jihoon Lee [Fri, 15 Oct 2021 06:29:42 +0000 (15:29 +0900)]
[Trivial] Move makeGraph function out

this patch moves makeGraph function from compiler_util -> test_util

**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>
2 years ago[Test] Make model test to take arbitrary nn
Jihoon Lee [Fri, 15 Oct 2021 06:05:15 +0000 (15:05 +0900)]
[Test] Make model test to take arbitrary nn

This patch updates model test to accept arbitrary neuralnetwork instead
of ini only

**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>
2 years ago[Trivial] Extract golden test from nnt_models
Jihoon Lee [Fri, 15 Oct 2021 04:52:57 +0000 (13:52 +0900)]
[Trivial] Extract golden test from nnt_models

This patch extracts golden test from nntrainer models, nothing done.

**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>
2 years ago[Trivial] Separate Watchers into a new file
Jihoon Lee [Fri, 15 Oct 2021 04:23:55 +0000 (13:23 +0900)]
[Trivial] Separate Watchers into a new file

This patch separates watchers into a new file

**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>
2 years ago[mem-opt] Support in-place batch normalization
Parichay Kapoor [Wed, 8 Sep 2021 11:56:50 +0000 (20:56 +0900)]
[mem-opt] Support in-place batch normalization

This patch provides support for in-place batch normalization.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[batchnorm] Optimize batch norm memory usage
Parichay Kapoor [Wed, 8 Sep 2021 11:48:16 +0000 (20:48 +0900)]
[batchnorm] Optimize batch norm memory usage

This patch optimized batch norm memory usage by updating the exec order
for its input as its not used in calcDerivative.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[in-place] Support in-place activation
Parichay Kapoor [Tue, 7 Sep 2021 07:21:27 +0000 (16:21 +0900)]
[in-place] Support in-place activation

This patch adds support for in-place activation. Further, the in-place
optimization has been moved to the model compile phase.
This patch also adds support for running the model in in-place as well
as out-of-place mode.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[LayerGroups] Normalize identifiers
Jihoon Lee [Thu, 14 Oct 2021 17:07:03 +0000 (02:07 +0900)]
[LayerGroups] Normalize identifiers

This patch normalize identifiers inside addWithRefrenceLayers() for further use

**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>
2 years ago[Refactor] Recurrent realizer with in/out props
Jihoon Lee [Thu, 14 Oct 2021 17:06:37 +0000 (02:06 +0900)]
[Refactor] Recurrent realizer with in/out props

This patch adds recurrent realizer with in/out props

**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>
2 years ago[Realizer] Implement input realizer
Jihoon Lee [Thu, 14 Oct 2021 16:14:06 +0000 (01:14 +0900)]
[Realizer] Implement input realizer

This patch implements input realizer which connect input to external
input

**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>
2 years ago[Realizer] Implement slice realizer
Jihoon Lee [Thu, 14 Oct 2021 11:06:23 +0000 (20:06 +0900)]
[Realizer] Implement slice realizer

This patch implements slice realizer and it's 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>
2 years ago[layer/test] Bug fix for dropout + unittest
Parichay Kapoor [Fri, 15 Oct 2021 11:37:20 +0000 (20:37 +0900)]
[layer/test] Bug fix for dropout + unittest

This patch adds bug fix for dropout for training as well as inference
mode. Futher, added unittest:
- when dropout_rate is 0 or 100%, all the values are checked
- when dropout_rate between 0 and 100, weak check ensures that either
values are equal or one of the values (golden vs output) is 0
- when dropout_rate r between 0 and 100, strong check ensures that
100 - 2*r percentage of values must always match

All the checks for performed in the unittests.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[Recurrent] Add timestep property to recurrent layers
Jihoon Lee [Thu, 14 Oct 2021 03:30:07 +0000 (12:30 +0900)]
[Recurrent] Add timestep property to recurrent layers

This patch creates recurrent layer setting property support to the
recurrent wrapper.

**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>
2 years ago[packaging] Debian launchpad buildfix for focal
Parichay Kapoor [Fri, 15 Oct 2021 03:55:36 +0000 (12:55 +0900)]
[packaging] Debian launchpad buildfix for focal

This patch provides buildfix for focal buildfix for launchpad.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[network] Bug fix for trainable with supportBackwarding
Parichay Kapoor [Thu, 14 Oct 2021 13:17:34 +0000 (22:17 +0900)]
[network] Bug fix for trainable with supportBackwarding

This patch resolves the bug for calling calcDerivative on layer which
do not support backwaring.
The issue rises from the assumption that there will be no layer
requiring backwarding after the last non-trainable layer. But this is
not valid for multi-input scenario. With multi-input, there can be over
two input layers where they both do not support backwarding but the rest of
the model can be trainable.

This patch changes this error check. Below are the updated semantics:
1. After initialization of the graph, a check is added to ensure that
for each trainable layer, all the layers all of ahead must support
backwarding, so that the trainable layer can be trained. If any layer
ahead of it does not support backwarding, error is thrown.
2. A layer is only trainable if its trainable property is set to true
(defaults to true) and contains at least 1 weight. If a layer does not
contain any weights, the layer is treated as non-trainable.
3. When backwarding the model, backwarding is called only for layers
which support backwarding, and skipped for layers which donot.

The updated semantics ensure the dependency of the flow of the
derivatives and allows mixture of layers which support and do not
support backwarding.

Resolves #1017

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[Model/API] renew addWithReferenceLayers
Jihoon Lee [Thu, 14 Oct 2021 06:55:15 +0000 (15:55 +0900)]
[Model/API] renew addWithReferenceLayers

This patch add refactored version of addWithReferenceLayers

**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>
2 years ago[Model] Add Model::addWithReferenceLayers
Jihoon Lee [Wed, 13 Oct 2021 13:26:53 +0000 (22:26 +0900)]
[Model] Add Model::addWithReferenceLayers

This patch add addWithReferenceLayers prototype

**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>
2 years ago[layer] Support setBatch for attention layer
Parichay Kapoor [Thu, 14 Oct 2021 11:58:30 +0000 (20:58 +0900)]
[layer] Support setBatch for attention layer

This patch provides support for setBatch for attention layer.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[layer] Add constructor for attention layer
Parichay Kapoor [Thu, 14 Oct 2021 10:36:49 +0000 (19:36 +0900)]
[layer] Add constructor for attention layer

This patch adds constructor for attention layer.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[layer] Support single timestep for lstm
Parichay Kapoor [Thu, 14 Oct 2021 03:28:34 +0000 (12:28 +0900)]
[layer] Support single timestep for lstm

This patch adds support for single timestep for lstm.
This is achieved with two external properties:

1. timestep - provides the current timestep for which lstm will run
2. max_timestep - the maximum timestep till which lstm will run

This patch also verifies that this LSTM implementation already does gradient stacking appropriately.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[layer] Bug fix of setBatch for LSTM/GRU/RNN
Parichay Kapoor [Thu, 14 Oct 2021 10:20:11 +0000 (19:20 +0900)]
[layer] Bug fix of setBatch for LSTM/GRU/RNN

LSTM/GRU/RNN requested tensors from manager and the shape of tensor
depends on the batch size. However, the layers didnot override the
setBatch to update the batchsize of the request tensors. This patch
provides the corresponding bugfix.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[layer] Remove setBatch for init context
Parichay Kapoor [Thu, 14 Oct 2021 10:06:59 +0000 (19:06 +0900)]
[layer] Remove setBatch for init context

This patch remove setBatch for the init context from the layer
interface. setBatch is now only needed to be set for runContext.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[graph/model] Support for multi-label/input for the model
Parichay Kapoor [Thu, 14 Oct 2021 08:51:37 +0000 (17:51 +0900)]
[graph/model] Support for multi-label/input for the model

This patch adds the support for mutli-label while training the model.
- Multi labels/inputs are now allowed for the model by taking the
dimensions from the graph than the first and last nodes
- Outputs are now also taken from the graph for validation

Another bug fix is added related to setBatch. The caches input and label
dimensions were not updated when batchsize was updated in the network
graph. This patch updates the bug for updating the batch size in the
network graph.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[Sharing] SKip saving shared weights
Jihoon Lee [Thu, 14 Oct 2021 02:00:01 +0000 (11:00 +0900)]
[Sharing] SKip saving shared weights

If weight is not original, skip saving 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>
2 years ago[Recurrent] Implement finalizing graph
Jihoon Lee [Tue, 12 Oct 2021 16:57:05 +0000 (01:57 +0900)]
[Recurrent] Implement finalizing graph

This patch implements finalizing graph with/without return sequence
property

**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>
2 years ago[Recurrent] Implement unrolling
Jihoon Lee [Tue, 12 Oct 2021 16:12:03 +0000 (01:12 +0900)]
[Recurrent] Implement unrolling

This patch implement unrolling in RecurrentRealizer

**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>
2 years ago[LayerNode] Add cloneConfiguration function
Jihoon Lee [Tue, 12 Oct 2021 15:00:10 +0000 (00:00 +0900)]
[LayerNode] Add cloneConfiguration function

This patch add cloneConfiguration function, which creates a new node
from an exisiting node

**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>
2 years ago[Recurrent] Add verification and preparation
Jihoon Lee [Tue, 12 Oct 2021 14:50:28 +0000 (23:50 +0900)]
[Recurrent] Add verification and preparation

This patch add logic to verify and add connection from input <->
external inputs

**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>
2 years ago[Realizer] Implement remap realizer
Jihoon Lee [Tue, 12 Oct 2021 12:41:43 +0000 (21:41 +0900)]
[Realizer] Implement remap realizer

This patch introduce remap realizer which remaps identifier inside a
graph representation. Please refer to the test to see what this realizer
does.

**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>
2 years ago[Recurrent] Add skleton of recurrent realizer
Jihoon Lee [Tue, 12 Oct 2021 11:02:53 +0000 (20:02 +0900)]
[Recurrent] Add skleton of recurrent realizer

This patch add skeleton of and some basic verification
for the recurrent realizer

**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>
2 years ago[ Conv1D ] Add Skeleton code for Conv1D Layer
jijoongmoon [Wed, 13 Oct 2021 11:45:58 +0000 (20:45 +0900)]
[ Conv1D ] Add Skeleton code for Conv1D Layer

This commit includes:
  . Skeleton code for conv1D
  . Padding1D Property
  . and minor

Signed-off-by: jijoongmoon <jijoong.moon@samsung.com>
2 years ago[Realizer] Apply flatten realizer
Jihoon Lee [Tue, 12 Oct 2021 08:37:51 +0000 (17:37 +0900)]
[Realizer] Apply flatten realizer

This patch applies flatten realizer to model compile. Later, neuralnet
will not have model_graph until compile() is being called

**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>
2 years ago[Model] Add memory optimization property
Jihoon Lee [Tue, 12 Oct 2021 08:34:21 +0000 (17:34 +0900)]
[Model] Add memory optimization property

This patch add memory optimization property to neuralnetwork. The main
purpose of this is to fixating memory optimzation boolean to be applied
only at neuralnet::compile();

**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>
2 years ago[Test/realizer] Add flatten realizer test
Jihoon Lee [Tue, 12 Oct 2021 06:49:03 +0000 (15:49 +0900)]
[Test/realizer] Add flatten realizer test

This patch adds flatten realizer 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>
2 years ago[Sharing] Implement tensor sharing
Jihoon Lee [Wed, 13 Oct 2021 10:48:28 +0000 (19:48 +0900)]
[Sharing] Implement tensor sharing

This patch implement tensor sharing.

**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>
2 years ago[test/layers] Add gru layer testing
Parichay Kapoor [Wed, 13 Oct 2021 05:38:24 +0000 (14:38 +0900)]
[test/layers] Add gru layer testing

This patch added gru layer unittest for layer golden tests.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
2 years ago[Graph] Add realizer test skeleton
Jihoon Lee [Sat, 9 Oct 2021 08:54:21 +0000 (17:54 +0900)]
[Graph] Add realizer test skeleton

This patch add realizer test skleton with separating utils to compiler
test utils

**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>
2 years ago[Graph/recurrent] Add concept of realizer
Jihoon Lee [Sat, 9 Oct 2021 08:26:47 +0000 (17:26 +0900)]
[Graph/recurrent] Add concept of realizer

This patch add graph realizer. Graph realizer will preprocess graph
which can be effectively done as a lowering process of compile

**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>
2 years ago[Interpreter] Change signature of interpreter
Jihoon Lee [Sat, 9 Oct 2021 07:54:53 +0000 (16:54 +0900)]
[Interpreter] Change signature of interpreter

Instead of returning networkgraph from the interpreter, it returns the
graph representation, which is a specification to generate a graph.

**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>