From: MyungJoo Ham Date: Mon, 28 Mar 2022 02:30:56 +0000 (+0900) Subject: filter:pytorch: armhf error in PPA (print format) X-Git-Tag: accepted/tizen/unified/20220419.142310~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b6616ad3253264d0c46ee6e0c3d8a7f26d5ce40b;p=platform%2Fupstream%2Fnnstreamer.git filter:pytorch: armhf error in PPA (print format) 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 /<>/ext/nnstreamer/tensor_filter/tensor_filter_pytorch.cc:29: /<>/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 ^~~~~~~~~~ /<>/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 ^~~~~~~~~~ /<>/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 --- diff --git a/ext/nnstreamer/tensor_filter/tensor_filter_pytorch.cc b/ext/nnstreamer/tensor_filter/tensor_filter_pytorch.cc index 141beca..2177b53 100644 --- a/ext/nnstreamer/tensor_filter/tensor_filter_pytorch.cc +++ b/ext/nnstreamer/tensor_filter/tensor_filter_pytorch.cc @@ -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; }