Parichay Kapoor [Wed, 6 Oct 2021 07:32:47 +0000 (16:32 +0900)]
[layer] Add checks for layer tensor overwrite bug
This patch adds a check to ensure that when layer tensors are created
and overwrites existing tensors. These checks are enabled only in DEBUG
mode to ensure that they only run in CI mode, and are called after each
operation - forwarding, calcGradient, and calcDerivative.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 3 Sep 2021 09:46:52 +0000 (18:46 +0900)]
[conv] Update temporary memory requests
This patch updates the request for temporary memory in the convolution
layer.
- im2col and col2im results are both the same size and used exclusive of
each other but both are requested for the backwarding. so, instead of
requesting both, they can share their memories.
- as the values in these tensors can be discarded between forwarding and
backwarding, two independent tensors are requested for forwarding and
backwarding so that the memory can be reused in the intermediate
duration.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Jihoon Lee [Wed, 6 Oct 2021 03:17:28 +0000 (12:17 +0900)]
[Dataset/test] Update batch before creating tensor
Dataset sample creating now creates a tensor after updating batch to one
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
resolves #1604
Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
Parichay Kapoor [Fri, 1 Oct 2021 08:23:04 +0000 (17:23 +0900)]
[layer] Add backwarding for attention layer
This patch adds backwarding for attention layer. Corresponding unittests
will be added in the next patch.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 1 Oct 2021 06:09:21 +0000 (15:09 +0900)]
[layer/test] Add basic test for attention
This patch adds basic unittest for attention layer.
To achieve, the existing tests are modified to support multiple inputs
in the test format.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 1 Oct 2021 06:01:18 +0000 (15:01 +0900)]
[layer] Scaffolding attention layer
This patch adds the initial commit for attention layer.
- add class description
- add basic forwarding
This implements the common form of attention layer where key and value
are the same tensor. The other format will be supported soon.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 1 Oct 2021 05:59:49 +0000 (14:59 +0900)]
[layernode] Bug fix for finalize
This patch adds bug fix for finalize of the layer node. The checks of
the inputs dimensions and input shapes has been fixed when multiple
inputs are expected to be set.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Jihoon Lee [Fri, 24 Sep 2021 08:10:25 +0000 (17:10 +0900)]
[Test] Add warmup to the golden layer
This patch add warmup forwarding to the layer golden 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>
Jihoon Lee [Fri, 24 Sep 2021 08:00:39 +0000 (17:00 +0900)]
[Test] Add conv2d golden tests
**Changes proposed in this PR:**
- Conv2d Golden tests
- remove _golden_ to the name of test cases, as it is attached in the
extension
**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>
Parichay Kapoor [Tue, 28 Sep 2021 10:59:50 +0000 (19:59 +0900)]
[batchnorm] Optimize batch norm backwarding
Remove the extra full size extra memory requirement as the cost of the
reduced memory. The difference in memory requirmement can be
significant. Earlier memory requirement was b*c*h*w vs now it is just c
where the assumption is that batch norm if is normalizing along
axis=channel.
This is achieved by reordering of the operations.
Note: this change has no performance impact.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Tue, 28 Sep 2021 10:40:33 +0000 (19:40 +0900)]
[batchnorm] Optimize batch norm forward memory
Reduce the memory comsumption of batch norm for forwarding by re-using
the output tensor as temporary memory than requesting new memory.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Wed, 6 Oct 2021 02:35:50 +0000 (11:35 +0900)]
[rebase] Rebase fix
This patch adds rebase fix.
Further some of the temporary fixes in the previous commits are also
removed.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Mon, 6 Sep 2021 09:39:37 +0000 (18:39 +0900)]
[in-place] Make input layer work in-place
This patch makes input layer work inplace. This is done by support of
externally allocated tensors in tensorPool, and making input of input
layer and labels to be externally allocated tensors.
Input layer is updated to work in-place.
Further the methodology to set inputs and labels has also been updated.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Mon, 6 Sep 2021 04:50:40 +0000 (13:50 +0900)]
[inplace opt] Support in-place no-op flatten layer
This patch updates the flatten layer to be a no-op layer. This is done
with the flatten layer setting the input and output shapes at finalize
time and making flatten layer execute in-place. Changes in this patch:
1. requestPreallocatedTensor() in TensorPool now returns a new tensor
which will eventually share the memory with the preallocated tensor than
returning the preallocated tensor itself. This allows tensor metadata to
be changed (like name, shape, etc) which sharing the memory. This is
done by storing the dependency link between tensors in token.
Corresponding unittests are also added.
2. Manager now supports giving shared tensors for outputs (shared with
some inputs) to support in-place running of some layers.
3. Flatten layer is updated to be a basic no-op and to perform
flattening once at compile time.
4. Update flatten layer supportBackwarding to true
5. Input layer updated to not edit tensor mapping. Input layer will be
updated to be in-place in the next patch.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 3 Sep 2021 08:59:21 +0000 (17:59 +0900)]
[graph/manager] Enable memory v1 optimizations
This patch adds interface to enable memory optimizations with the neural
network. Enabling the interface changes the planner being used for the
memory allocation.
With this patch, OptimizedV1Planner is put to use when enabling
optimizations.
Unittest of models is updated to disable optimizations in the
non-optimized test cases.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 3 Sep 2021 08:40:09 +0000 (17:40 +0900)]
[bug fixes] Add bug fixes to manager + tensor pool
This patch adds the corresponding bug fixes:
- end validity for each requested tensor is fixed
- execution order for requestInputs and requestOutputs are fixed
- output is specially handled for activation layer as it uses output in
derivative calculation
- gradient of the weights is kept valid for calcDerivative as well
because gradients are applied to weights after calcDerivative.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 3 Sep 2021 08:37:43 +0000 (17:37 +0900)]
[planner] Update optimized v1 planner
Optimized v1 planner is updated to reuse expired allocations which are
not at the top the sorted list. This is a heuristic which works well for
training memory usage scenario.
The unittest is also updated to be more generic when checking the
interval overlap with the allocations.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 3 Sep 2021 08:31:02 +0000 (17:31 +0900)]
[networkgraph] Bug fix in execution order calculation
Added bug fix in the execution order calculation where some of the
execution values were being missed in the previous implementation.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 3 Sep 2021 08:27:52 +0000 (17:27 +0900)]
[flatten] Remove in-place implementation
Flatten layer in-place implementation manipulates the tensor stored in
its input and output. This violates the execution order usage of the
tensors and does not work with the memory planning setup.
This patch makes flatten layer to work out-of-place with a copy.
There will soon be a patch to make flatten work in-place with proper
method.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 1 Oct 2021 04:24:10 +0000 (13:24 +0900)]
[rebase] Add rebase fix
Add rebase fix to the memory unitest. Memory unittest was updated to
shuffle the validity of the requests. However, the unittest check was
not ready for it. This patch adds the sort of the validity before
performing the check, corresponding to the previously added shuffle.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Tue, 7 Sep 2021 01:59:53 +0000 (10:59 +0900)]
[memoryPool] Release memory on destroy
This patch adds releasing all the memory upon destruction of the memory
pool.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 3 Sep 2021 04:53:29 +0000 (13:53 +0900)]
[planner] Optimized v1 planner unittests
This patch adds unittests for the optimized v1 planner.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 3 Sep 2021 04:50:57 +0000 (13:50 +0900)]
[planner] Add optimized v1 planner
This patch add optimized v1 planner for memory sharing.
This planner assigns memory in the order of start of the validity,
and then by decreasing order of the end of the validity. This matches
the memory use pattern while training the model.
This planner is supposed to work better for training than for inference.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Thu, 2 Sep 2021 06:59:30 +0000 (15:59 +0900)]
[rebase] Rebase fix
This patch adds rebase fix.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 27 Aug 2021 12:30:59 +0000 (21:30 +0900)]
[resnet] Enable resnet application
This patch enables resnet application with some fixes:
- setBatchSize updated for handling gradient tensors
- added input layer for resnet
- passed arguments correctly for resnet test application
- tensor allocation for ENABLE_TEST mode updated
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 24 Sep 2021 11:58:10 +0000 (20:58 +0900)]
[batchnorm] Optimize batch norm layer
This patch optimizes batch norm layer and tries to share the
calculations performed in calcGradient and calcDerivative.
- reuse dbeta and dgamma calculations
- reduce number of required temporary variables
- create all the required tensor variables with context
- add support for checking if the layer is trainable or not via run
context
- support average operation with the output tensor already allocated
- this patch reduces as much as memory as possible without sacrificing
speed. more memory optimization is possible at the expense of speed but
has been ommitted for now.
Note: this patch has slight improvement in performance, and adds no
extra operations.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 24 Sep 2021 09:08:38 +0000 (18:08 +0900)]
[batchnorm] Optimize batch normalization implementation
This patch optimizes batch normalization implementation.
Reduces the temporary memory allocation and provide speedup for the
layer execution. With this patch, resnet18 runtime improves by approx
5%.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Jihoon Lee [Fri, 24 Sep 2021 06:05:15 +0000 (15:05 +0900)]
[Test] Add bn layer inference test
**Changes proposed in this PR:**
- bn layer inference mode test
- add option to skip backwarding golden 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>
Parichay Kapoor [Tue, 28 Sep 2021 08:20:34 +0000 (17:20 +0900)]
[rebase] Add rebase fix
This patch adds rebase fix:
- isLabelAvailable is checked with allocation than based on size
- var_grad initialize variable is temporarily updated till externally
allocated tensors are supported #1544
- 2 dataset unittests are disabled till externally allocated tensors are
supported with #1544
- other minor edits arising from rebase to main
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Thu, 26 Aug 2021 10:26:27 +0000 (19:26 +0900)]
[cleanup/fix] Cleanup + bugfix
This patch provides cleanup for manager and related classes:
- cleanup for Manager
- cleanup for Var_Grad and Weights
Fixes:
- Graphcore,NetworkGraph,NeuralNet destructor fixed to not clear their
lists until they are destructed, as this caused bug in copy constructor
- initialize and allocation for tensors are merged for model, graph and
manager interface. This removes unnecessary confusion and possible bugs
from these classes
- Pass appropriate start and end execution orders to manager for
allocation
- Support setInputs to set multiple inputs
- clean inputs/labels which are allocated by the dataset, other manager
tries to clear them. This is temporary till dataset is not using the
manager
- memory pool to start giving tokens from 1 instead of 0. token 0 is
treated at a non-requested tensor memory
- add interface to check if the tensor pool and memory pool have
allocated memory
- initialize all the tensors token to 0, when finalizing multiple times
- tensor behavior update to not allow updateBatch() if it is allocated
- update setBatch to deallocate already allocated tensors, then update
the batch size, and then initialize and allocate the tensors
TODO:
- add a enableMemoryOptimization() option
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Tue, 28 Sep 2021 05:45:50 +0000 (14:45 +0900)]
[manager] Temporarily handle external tensors
With rebase, the var_grads representing inputs cannot be null tensors.
This patch provides a temporary fix for this issue. Proper fix for the
issue is added in #1544.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Tue, 28 Sep 2021 05:37:26 +0000 (14:37 +0900)]
[layernode] Bug fix for loss
getLoss() was adding loss from the loss layer to the total loss of the
layer with every call to getLoss() which was resulting in wrong results.
This patch adds the corresponding fix.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Wed, 25 Aug 2021 08:26:21 +0000 (17:26 +0900)]
[Manager] Manager to use TensorPool for all requests
This patch updates manager to use TensorPool for all of its requests.
Other changes are as listed below:
- NetworkGraph now caches the inputs and labels Var_Grads which can
directly by the model before execution.
- setLabels and setInputs in the model have been updated. Further,
manual setting of inputs and labels has been removed.
- Introduce clear in memory pool to clear any allocations and requests
- TensorPool clears any requests made before making more requests in
finalize
- models unittest updated to not pass label when loss is not given in
the model. Passing label without loss in the model now results in error
- Manager updated to use tensor pool for all the memory requests. The
allocation, initialization and deallocation has been correspondingly simplified
Much needed cleanup will be done in the next commit.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
[squash commit]
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Jihoon Lee [Thu, 23 Sep 2021 08:00:03 +0000 (17:00 +0900)]
[Test] Add bn layer training
**Changes proposed in this PR:**
- Add batchnormalization layer test (for channel, width axis)
**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>
Jihoon Lee [Thu, 30 Sep 2021 09:58:56 +0000 (18:58 +0900)]
[Fix] gcc-7 has compile error
This patch fixes gcc compile error (-wsign-compare,
-wmaybe-uninitialized)
**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>
Parichay Kapoor [Mon, 27 Sep 2021 09:35:50 +0000 (18:35 +0900)]
[fix] Rebase fix
This patch adds fix when rebase to the main branch.
Due to significant changes to the main branch, certain patches have
been taken from future PRs:
- from #1539, commit
b58c72a54ab445f34f5839314df65e849f393b11 has been
cherry picked to solve the issue of tensor shape related with batch size
changes
- from #1539, memory pool to start giving tokens from 1 instead of 0. token 0 is
treated at a non-requested tensor memory
These patches might seem a bit out of the way but instead of taking
partial functionality, either full commits have been cherry-picked here
or minor functionality has been manually imported.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Thu, 2 Sep 2021 06:59:30 +0000 (15:59 +0900)]
[tensorpool] Make tensor list ordered
This patch makes tensor list in tensorpool ordered.
This ensures that the requested tensors are initialized in the order of
the their requests which is by the order of the sorted graph.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Wed, 25 Aug 2021 04:48:46 +0000 (13:48 +0900)]
[Manager] Use TensorPool for Gradients
Use TensorPool for gradients of the weights.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Mon, 23 Aug 2021 10:35:59 +0000 (19:35 +0900)]
[Manager] Manager use TensorPool for Weights
This patch updates manager to use TensorPool for its weights and
corresponding weights. Corresponding changes to Var_Grad/Weights and
Tensors are also added.
- setBatchSize() now takes dimensions from user, and then updates the
provides these updates dimensions to the manager. We can possibly remove
setBatch(RunLayerContext), which will be finalized in the next commit.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Mon, 23 Aug 2021 10:33:59 +0000 (19:33 +0900)]
[layers] bugfix for layers
This patch adds bugfixes for layers:
1. acti_func in-place support bug
2. batch normalization layer weight name bug
3. loss layers not using tensor reference bug
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Jihoon Lee [Thu, 23 Sep 2021 07:19:07 +0000 (16:19 +0900)]
[Test] Update layer golden test format
**Changes proposed in this PR:**
- Add initial_weight to the layer golden data
- Add layer::build() point to the translayer
- Properly call layer instead of __call__ in translayer
- Run formatter(black)
**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>
Parichay Kapoor [Fri, 20 Aug 2021 11:10:55 +0000 (20:10 +0900)]
[TensorPool] Added tensor pool implementation
Added tensor pool implementation with unittests.
Tensorpool provides the interface where all the requested tensors are
managed at one places ensuring the uniqueness of name with their
lifespan and execution orders.
Corresponding unittests checking the working is added.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 20 Aug 2021 07:40:16 +0000 (16:40 +0900)]
[tensorpool] Introducing TensorPool
This patch introduces TensorPool which manages the list of all the
tensors with their execution orders and lifespan.
The conversion of lifespan and execution orders to the validity will be
done by the TensorPool.
TensorPool forms the middle ground between memory pool and manager for
easier maintainance.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Tue, 17 Aug 2021 04:06:30 +0000 (13:06 +0900)]
[manager] Use memory pool for weights
This patch updates the use of memory pool for the weights of the model.
Correspondingly a pool object is added to the manager.
The pool is allocated in the weights allocation.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Jihoon Lee [Fri, 17 Sep 2021 04:29:04 +0000 (13:29 +0900)]
[Profiler] Enable profiler with fine grained profile
This patch enables profiler with layer profiling.
**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>
Parichay Kapoor [Fri, 13 Aug 2021 06:03:10 +0000 (15:03 +0900)]
[manager] Constraint input and ouput tensor sharing
Add the constraint of the output tensors of a node with the input
tensors of the next nodes. This allows memory pool to understand the
manager that these two inputs/outputs must use the same tensor and
enables tensor sharing.
This is acheieved by requesting already creating tensors with the given
name.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 13 Aug 2021 05:01:49 +0000 (14:01 +0900)]
[manager] Create lifetime and usage list by tensors
Create a lifetime and usage list for all the tensors which have been
requested by the manager in the form of weights/inputs/outputs/trainable
tensors.
A tensor name based map is used as each tensor has the name identifier.
Further, the restriction of the name to be unique is added for the
tensors which are requested by the manager.
TensorLifespan enum values are updated to be of the form of bit wise
enabling. This allows checking and upgrading lifespan of an existing
tensor.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Thu, 12 Aug 2021 10:57:34 +0000 (19:57 +0900)]
[VarGrad] Cleanup for VarGrad
This patch cleansup VarGrad implementation, and ends up removing all its
members except the variable and gradient tensors (fitting exactly to its
description).
Resolves #1486
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Thu, 12 Aug 2021 10:40:08 +0000 (19:40 +0900)]
[tensor] Add name identifier to Tensor
Move name as an identifier to the tensor.
This name has been mvoed from the Var_Grad object.
Var_Grad now does not contain name itself.
The semantics of name for Tensor currently follows from var-grad:
- empty name is allowed
- repititive names are allowed
Restrictions can and will be added over time.
Resolves #1485
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Thu, 12 Aug 2021 08:44:53 +0000 (17:44 +0900)]
[manager] Flatten tensors list
Flatten the tensors (weights/inputs/outputs/tensors) list stored in the
manager. It was of the form vector<vector<>> to club the tensors
requested from a layer together. However, this is neither required now
nor is it sufficient. If required later, a mapping from node will be
created.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Wed, 11 Aug 2021 09:09:17 +0000 (18:09 +0900)]
[memorypool/test] Unittests for memory pool
This patch adds unittests for memory pool for its public APIs.
Further, memory validation is added for the requested memories and
those tests will be added for each planner. This ensures that the
memories returned by each planner do not overlap, and remain valid while
usage.
Fixes corresponding to the unittests are also added.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Wed, 11 Aug 2021 05:59:00 +0000 (14:59 +0900)]
[memoryPool] Implementation for memory pool
This patch provides implementation for memory pool which uses a memory
planner to plan the layout of the memory and provides efficiency of the
given planner.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
jijoong.moon [Fri, 24 Sep 2021 04:51:33 +0000 (13:51 +0900)]
[ Release ] NNTrainer 0.3.0 Release
NNTrainer v0.3.0 is released.
**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>
Parichay Kapoor [Fri, 17 Sep 2021 04:56:11 +0000 (13:56 +0900)]
[resnet/test] Add resnet test for models unittest
This patch adds resnet models unittest for resnet18.
The verification has been done offline for 2 iterations for the output
of all layers with precision of 1.1e-4.
Derivaitves and gradients have higher error because of relu: when some
value is close to 0, it can be positive or negative with some error (of
the order of e-7). Although this error is way within the error limit.
however, this exacerbates the error in backwarding where derivatives (which
are significant in values) can flow if the relu value was over 0, and
not flow if under zero. This is manageable in smaller models but
difficult to avoid in unittests for larger models.
Other bug fixes in this patch:
- max error reported by unittest_nntrainer_models has been fixed
- error reporting now includes layer type as well
- ModelTestOption MINIMUM has been renamed to NO_THROW_RUN
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 17 Sep 2021 04:54:47 +0000 (13:54 +0900)]
[resnet/test] Add resnet unittest model generation
This patch adds resnet18 unittest model generation with genModelTests.
Further, the input data range is changed from 0 to x from -x to x as
relu based models work better with 0 to x data range to prevent loss of
information.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Thu, 23 Sep 2021 02:09:59 +0000 (11:09 +0900)]
[resnet] Add test to resnet application
This patch adds test check on the training of the resnet application.
This test can be enabled with enable-long-test and enable-test.
Resolves #1533
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 17 Sep 2021 04:27:26 +0000 (13:27 +0900)]
[tensor] Reduce num of operations for tensor sum
This patch reduces the number of operations required for tensor sum by
accumulating the consecutive axes in order to increase the precision of
the operation.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 17 Sep 2021 04:05:57 +0000 (13:05 +0900)]
[application] Update resnet to match tensorflow
Update resnet application to match tensorflow implementation.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Mon, 13 Sep 2021 07:36:39 +0000 (16:36 +0900)]
[application] Add resnet18 tensorflow version
Add resnet18 tensorflow version to match against nntrainer.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Jihoon Lee [Thu, 9 Sep 2021 10:26:07 +0000 (19:26 +0900)]
[TEST/fc] Add layer golden test
This patch adds layer golden test format
**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>
Jihoon Lee [Thu, 9 Sep 2021 10:14:55 +0000 (19:14 +0900)]
[Test] Prepare layer golden test data
This patch prepares code to generate binary and package two tests for
example
**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>
Parichay Kapoor [Fri, 17 Sep 2021 05:07:38 +0000 (14:07 +0900)]
[gitignore] Update gitignore
Update gitignore to ignore the following files:
- data files for applications
- log files
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Thu, 16 Sep 2021 10:48:34 +0000 (19:48 +0900)]
[unittest/models] Fix matching for models unittest
This patch fixes the matching for the last layer of each model for the
unittest of the models.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Fri, 17 Sep 2021 04:28:36 +0000 (13:28 +0900)]
[layer] Bug fixes for layers
This patch adds bug fixes for layers:
- bn layer support in-place is corrected.
- flatten layer support in-place is corrected.
- pooling layer padding related corrections.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Jihoon Lee [Wed, 15 Sep 2021 11:52:01 +0000 (20:52 +0900)]
[Fix] Svace issue and minor bugs
**Changes proposed in this PR:**
- implement save_ini_with_bin format
- delete noexcept specifier in node exporter
- ini interpreter skips newly reserved sections
- Add member initializer in TfOpNode
- fix unused warning in padding for under gcc 9
**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>
Jihoon Lee [Wed, 15 Sep 2021 10:01:17 +0000 (19:01 +0900)]
[tcm] Fix tcm criticals
This patch fixes tcm no assertion error while disabling actual no
asserting tc
**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>
Jihoon Lee [Mon, 13 Sep 2021 04:48:10 +0000 (13:48 +0900)]
[Interpreter] Enable tests
Interpreter test was not running, this patch enables interpreter 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>
[Fix] Enable tflite saver
This patch reflects changes occured from layer_v2 patch
**Changes proposed in this PR:**
- tflite interpreter save is now proper test
- tflite interpreter now uses tensor * instead of var grad
- majorly updated how to create tf_opnode
**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>
hyeonseok lee [Wed, 15 Sep 2021 04:15:27 +0000 (13:15 +0900)]
[util] Remove parse_util.h
- Deleted parse_util.h, parse_util.cpp
- Move functions in props_util.h to util_func.h and deleted props_util.h
- Remove unused function in util_func
Self evaluation:
Build test: [X]Passed [ ]Failed [ ]Skipped
Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
Jihoon Lee [Wed, 15 Sep 2021 01:54:54 +0000 (10:54 +0900)]
[Conv2d] Conv2d Padding Fix
This patch resolves conv2d calculation is crooked in some cases
**Changes proposed in this PR:**
- Conv2d Fix
- Padding::Compute Fix
- Pooling2d Fix
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Co-authored-by: Parichay Kapoor <pk.kapoor@samsung.com>
Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
Jihoon Lee [Wed, 15 Sep 2021 07:29:34 +0000 (16:29 +0900)]
[Fix] upstream build fail
This patch fixes upstream build fail from overlapping test suite name
**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>
hyeonseok lee [Tue, 14 Sep 2021 07:03:41 +0000 (16:03 +0900)]
[unittest] Enable model_test_save_load_compare unittest to ALL
- Except addition_resnet_like, multiple_output_model which contain
multiout layer cause cannot assure the order of layer
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
hyeonseok lee [Tue, 14 Sep 2021 06:49:16 +0000 (15:49 +0900)]
[ahub] Init uninit member variable
- Initialize uninit member variable
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
hyeonseok lee [Tue, 14 Sep 2021 03:21:45 +0000 (12:21 +0900)]
[layer] bugfix in set acti_func of rnn, lstm, gru
- Set acti_func, recurrent_acti_func in finalize
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
Jihoon Lee [Tue, 14 Sep 2021 08:00:04 +0000 (17:00 +0900)]
Enable Saving props by delimiter '|'
This patch enables saving properties by delimiter '|'
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Cc: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
Jihoon Lee [Tue, 14 Sep 2021 06:03:45 +0000 (15:03 +0900)]
[test/layers] enable tests when only available
This patch enables tests when only available. for example,
unittest_layers_nnstreamer.cpp cannot be run on tizen so excluded.
**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>
Jihoon Lee [Mon, 13 Sep 2021 05:27:41 +0000 (14:27 +0900)]
[gbs fix] Enable test not running with main lib
**Changes proposed in this PR:**
- Enable test not running with main lib
- Enable memory test
- Enable fix for the props checking bug
**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>
Jihoon Lee [Fri, 10 Sep 2021 04:58:10 +0000 (13:58 +0900)]
[Fix] Fix semantic tests were not running
This patch fixes semantic tests were not running
**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>
Jihoon Lee [Thu, 9 Sep 2021 12:51:40 +0000 (21:51 +0900)]
[Spec] Exclude generated coverage items
This patch excludes generated coverage items from daily coverage report
**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>
hyeonseok lee [Mon, 13 Sep 2021 06:52:27 +0000 (15:52 +0900)]
[LayerImpl] Maintain LayerImpl property with props
- All the layerImpl property will be maintain with props
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
hyeonseok lee [Tue, 7 Sep 2021 07:44:27 +0000 (16:44 +0900)]
[layer] clean up parse_util header
- parse_util header is no longer needed cause setProperty function is deleted
so clean up header
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
hyeonseok lee [Thu, 9 Sep 2021 23:55:40 +0000 (08:55 +0900)]
[bn layer] Maintain bn layer property with props
- All the property will be maintain with props
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
hyeonseok lee [Thu, 9 Sep 2021 14:11:06 +0000 (23:11 +0900)]
[rnn lstm gru layer] Maintain rnn, lstm, gru layer property with props
- All rnn, lstm, gru layer property will be maintain with props
- Allow dropout to zero
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
hyeonseok lee [Thu, 9 Sep 2021 06:15:49 +0000 (15:15 +0900)]
[pooling2d layer] Maintain pooling2d layer property with props
- All pooling2d layer property will be maintain with props
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
hyeonseok lee [Wed, 8 Sep 2021 03:46:07 +0000 (12:46 +0900)]
[preprocess flip layer] Maintain layer property with props
- All the preprocess flip layer property will be maintain with props
- Remove default flip direction value which was horizontal_and_vertical
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
hyeonseok lee [Tue, 7 Sep 2021 06:32:11 +0000 (15:32 +0900)]
[conv layer] Maintain conv layer property with props
- All the conv layer property will be maintain with props
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
hyeonseok lee [Tue, 7 Sep 2021 03:43:08 +0000 (12:43 +0900)]
[preprocess translate layer] Maintain layer property with props
- All the preprocess translate layer property will be maintain with props
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
hyeonseok lee [Mon, 6 Sep 2021 08:26:53 +0000 (17:26 +0900)]
[split layer] Maintain split layer property with props
- All the property of split layer will be maintain with props
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
hyeonseok lee [Mon, 6 Sep 2021 08:13:01 +0000 (17:13 +0900)]
[embedding layer] Maintain embedding layer property with props
- All the property of embedding layer will be maintain with props
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
hyeonseok lee [Mon, 6 Sep 2021 05:20:14 +0000 (14:20 +0900)]
[input layer] Maintain input layer property with props
- All the property of input layer will be maintain with props
- Remove unused setProperty function of tflite_layer
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: hyeonseok lee <hs89.lee@samsung.com>
Jihoon Lee [Wed, 8 Sep 2021 10:49:54 +0000 (19:49 +0900)]
[Test] Add save load test
Add save load test while adding options to 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>
Jihoon Lee [Tue, 7 Sep 2021 12:14:57 +0000 (21:14 +0900)]
[ini] Implement dataset save/loader
This patch implements dataset saver/loader.
This patch propose sections "train_set", "valid_set", "test_set". Just
like 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>
Jihoon Lee [Tue, 7 Sep 2021 09:51:14 +0000 (18:51 +0900)]
[Props] Implement activation property
This patch implements activation property by enum
**Additional changes**
- TimeDistribute property is now handled at finalize()
**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>
Jihoon Lee [Thu, 9 Sep 2021 04:14:05 +0000 (13:14 +0900)]
[Bug] Fix support inplace for distribute Layer
This patch fixes support inplace for distirbute layer
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Cc: Parichay Kapoor <pk.kapoor@samsung.com>
Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
Parichay Kapoor [Wed, 8 Sep 2021 11:14:43 +0000 (20:14 +0900)]
[bnlayer] Batch norm layer bug fix
This patch provides bug fix to the initialization of the batch norm
values.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Wed, 8 Sep 2021 11:06:53 +0000 (20:06 +0900)]
[neuralnet] Fix validation reporting
Fix validation values reporting.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Wed, 8 Sep 2021 04:47:46 +0000 (13:47 +0900)]
[resnet] Fix data loader for resnet application
This patch fixes the data loader for resnet application after the
dataset loader has been changed to load data element by element than the
whole batch.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Parichay Kapoor [Wed, 8 Sep 2021 04:47:17 +0000 (13:47 +0900)]
[batchnorm] Bug fix for batch norm layer
Bug fix for requested variable for batch norm layer.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
Jihoon Lee [Tue, 7 Sep 2021 06:21:39 +0000 (15:21 +0900)]
[props] Support enum properties
This patch aims to support enum based properties, please refer to the
test to see how it works.
**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>
Jihoon Lee [Tue, 7 Sep 2021 03:54:26 +0000 (12:54 +0900)]
[Ini Save] input shape property
This patch includes input shape property generation
Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
Jihoon Lee [Mon, 6 Sep 2021 08:49:02 +0000 (17:49 +0900)]
[LayerNode] Change context to be RAII
This patch refactors context to be RAII to make layer node properties
dumb.
**Changes**
- init context is removed
- layer node instead created and returned from layerNode::finalize(input_dims)
- remove dependency to input dimension before initialize
- layerNode now has input_shapes instead of setting directly from initContext
- runcontext is used to query things
- fix multiple bugs regarding the validity of layer node
- networkGraph::updateRunContext() -> finalizeContext() now
finalizes inside this function for brevity
- layerNode::updateRunContext() -> configureContext() to make it RAIIer.
- minor code cleans in networkGraph::initialize
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>