filter:pytorch: armhf error in PPA (print format)
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 28 Mar 2022 02:30:56 +0000 (11:30 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Tue, 29 Mar 2022 05:01:31 +0000 (14:01 +0900)
Fix the print format string error:
```
In file included from /usr/include/glib-2.0/glib.h:62:0,
                 from ../gst/nnstreamer/nnstreamer_log.h:75,
                 from /<<PKGBUILDDIR>>/ext/nnstreamer/tensor_filter/tensor_filter_pytorch.cc:29:
/<<PKGBUILDDIR>>/ext/nnstreamer/tensor_filter/tensor_filter_pytorch.cc: In member function ‘int TorchCore::validateOutputTensor(at::Tensor, unsigned int)’:
/usr/include/glib-2.0/glib/gmessages.h:336:43: error: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘gsize {aka unsigned int}’ [-Werror=format=]
                                __VA_ARGS__)
                                           ^
../gst/nnstreamer/nnstreamer_log.h:79:17: note: in expansion of macro ‘g_critical’
 #define ml_loge g_critical
                 ^~~~~~~~~~
/<<PKGBUILDDIR>>/ext/nnstreamer/tensor_filter/tensor_filter_pytorch.cc:348:5: note: in expansion of macro ‘ml_loge’
     ml_loge ("Invalid output meta: different element size at index %d. Found size %ld while expecting size %ld. Update the tensor shape/size to resolve the error.",
     ^~~~~~~
/usr/include/glib-2.0/glib/gmessages.h:336:43: error: format ‘%ld’ expects argument of type ‘long int’, but argument 6 has type ‘gsize {aka unsigned int}’ [-Werror=format=]
                                __VA_ARGS__)
                                           ^
../gst/nnstreamer/nnstreamer_log.h:79:17: note: in expansion of macro ‘g_critical’
 #define ml_loge g_critical
                 ^~~~~~~~~~
/<<PKGBUILDDIR>>/ext/nnstreamer/tensor_filter/tensor_filter_pytorch.cc:348:5: note: in expansion of macro ‘ml_loge’
     ml_loge ("Invalid output meta: different element size at index %d. Found size %ld while expecting size %ld. Update the tensor shape/size to resolve the error.",
     ^~~~~~~
```

Related with #3698

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
ext/nnstreamer/tensor_filter/tensor_filter_pytorch.cc

index 141beca..2177b53 100644 (file)
@@ -315,7 +315,7 @@ TorchCore::validateOutputTensor (const at::Tensor output, unsigned int idx)
 
   /** if idx is in bounds */
   if (outputTensorMeta.num_tensors <= idx) {
-    ml_loge ("Invalid output meta: trying to access index %d with total %d tensors. Update the number of outputs to >=%d in the model description",
+    ml_loge ("Invalid output meta: trying to access index %u with total %u tensors. Update the number of outputs to >=%u in the model description",
         idx, outputTensorMeta.num_tensors, idx + 1);
     return -1;
   }
@@ -324,7 +324,7 @@ TorchCore::validateOutputTensor (const at::Tensor output, unsigned int idx)
   if (tensor_shape[0] == 0) {
     otype = getTensorTypeFromTorch (output.scalar_type ());
     if (outputTensorMeta.info[idx].type != otype) {
-      ml_loge ("Invalid output meta: different type at index %d. Update the type of tensor at index %d to %d tensor_type",
+      ml_loge ("Invalid output meta: different type at index %u. Update the type of tensor at index %u to %d tensor_type",
           idx, idx, otype);
       return -2;
     }
@@ -333,7 +333,7 @@ TorchCore::validateOutputTensor (const at::Tensor output, unsigned int idx)
 
   otype = getTensorTypeFromTorch (sliced_output.scalar_type ());
   if (outputTensorMeta.info[idx].type != otype) {
-    ml_loge ("Invalid output meta: different type at index %d. Update the type of tensor at index %d to %d tensor_type",
+    ml_loge ("Invalid output meta: different type at index %u. Update the type of tensor at index %u to %d tensor_type",
         idx, idx, otype);
     return -2;
   }
@@ -345,7 +345,7 @@ TorchCore::validateOutputTensor (const at::Tensor output, unsigned int idx)
   }
 
   if (num_gst_tensor != num_torch_tensor) {
-    ml_loge ("Invalid output meta: different element size at index %d. Found size %ld while expecting size %ld. Update the tensor shape/size to resolve the error.",
+    ml_loge ("Invalid output meta: different element size at index %u. Found size %lu while expecting size %lu. Update the tensor shape/size to resolve the error.",
         idx, num_torch_tensor, num_gst_tensor);
     return -3;
   }