[Svace] Fix Ahub issues
authorSeoHyungjun <hyungjun.seo@samsung.com>
Tue, 19 Sep 2023 07:04:52 +0000 (16:04 +0900)
committerJijoong Moon <jijoong.moon@samsung.com>
Wed, 20 Sep 2023 14:06:35 +0000 (23:06 +0900)
Added exception handling when malloc fails.

The value of the idx variable has been changed to be initialized when declared.

In the tensor constructor, output_axis was changed to be initialized to 3.

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

index f73dcce7da46485da9521b8215607e04a2f9911d..b3ac3a8e6ae78bcfcb6d828fee4c001f3da9dcec 100644 (file)
@@ -103,6 +103,7 @@ Tensor::Tensor(const TensorDim &d, bool alloc_now, Tensor::Initializer init,
     dim = d;
     strides = d.computeStrides();
     initializer = init;
+    output_axis = 3;
     if (alloc_now)
       allocate();
   }
index 610e4c77955d6bfbe7a0cc424222144ddbe84d7a..32cf041c546f4cce99f7d409bb6239b24d5023dd 100644 (file)
@@ -2032,7 +2032,7 @@ public:
       throw std::invalid_argument("Error: No scale factors");
     }
 
-    int idx;
+    int idx = 0;
     for (unsigned int b = 0; b < batch(); ++b) {
       for (unsigned int c = 0; c < channel(); ++c) {
         for (unsigned int h = 0; h < height(); ++h) {