[Ahub] Fix Ahub issue
authorSeoHyungjun <hyungjun.seo@samsung.com>
Wed, 23 Aug 2023 07:26:03 +0000 (16:26 +0900)
committerJijoong Moon <jijoong.moon@samsung.com>
Wed, 20 Sep 2023 06:47:40 +0000 (15:47 +0900)
Restore does not work as expected after changing ostream type.

Added because there is no code to restore the variable out.
Changed the code where the nesting depth was set incorrectly to the
correct location.

Signed-off-by: SeoHyungjun <hyungjun.seo@samsung.com>
nntrainer/tensor/tensor.cpp

index d4989db..f73dcce 100644 (file)
@@ -2649,8 +2649,8 @@ void Tensor::print(std::ostream &out) const {
         }
         out << "-------" << std::endl;
       }
-      out.copyfmt(init);
     }
+    out.copyfmt(init);
   } else if (getDataType() == ml::train::TensorDim::DataType::FP16) {
 #ifdef ENABLE_FP16
     const _FP16 *data = getData<_FP16>();
@@ -2696,8 +2696,8 @@ void Tensor::print(std::ostream &out) const {
         }
         out << "-------" << std::endl;
       }
-      out.copyfmt(init);
     }
+    out.copyfmt(init);
 #else
     throw std::invalid_argument("Error: enable-fp16 is not enabled");
 #endif
@@ -2878,6 +2878,7 @@ void Tensor::print_(std::ostream &out, uint opt) const {
       out << getData<float>()[i] << ", ";
     }
   }
+  out.copyfmt(init);
 }
 
 std::ostream &operator<<(std::ostream &out, Tensor const &m) {