[Fix] BN life span
authorJihoon Lee <jhoon.it.lee@samsung.com>
Thu, 13 Jan 2022 15:20:30 +0000 (00:20 +0900)
committerJijoong Moon <jijoong.moon@samsung.com>
Wed, 19 Jan 2022 10:51:43 +0000 (19:51 +0900)
t_reduced is used in forward, but lifespan was in backwarding. 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>
nntrainer/layers/bn_layer.cpp

index 5c7b553..f65d042 100644 (file)
@@ -128,7 +128,7 @@ void BatchNormalizationLayer::finalize(InitLayerContext &context) {
    */
   wt_idx[BNParams::t_full] =
     context.requestTensor(in_dim, "tensor_full", Tensor::Initializer::NONE,
-                          false, TensorLifespan::BACKWARD_FUNC_LIFESPAN);
+                          false, TensorLifespan::CALC_DERIV_LIFESPAN);
   /**
    * caches variance + epsilon as well.
    */
@@ -140,7 +140,7 @@ void BatchNormalizationLayer::finalize(InitLayerContext &context) {
    */
   wt_idx[BNParams::t_reduced] =
     context.requestTensor(dim, "tensor_reduced", Tensor::Initializer::NONE,
-                          false, TensorLifespan::BACKWARD_FUNC_LIFESPAN);
+                          false, TensorLifespan::FORWARD_DERIV_LIFESPAN);
 }
 
 void BatchNormalizationLayer::setProperty(