[CodeClean]remove duplicates in TFLiteCore::getTensorDim
authorJunsang Mo <junsang.mo@samsung.com>
Wed, 16 Oct 2019 11:40:21 +0000 (20:40 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 17 Oct 2019 00:36:33 +0000 (09:36 +0900)
make a variable for interpreter->tensor (tensor_idx)->dims.
replace interpreter->tensor (tensor_idx)->dims with the variable.

Signed-off-by: Junsang Mo <junsang.mo@samsung.com>
ext/nnstreamer/tensor_filter/tensor_filter_tensorflow_lite_core.cc

index dd185ff..4dbe8a3 100644 (file)
@@ -269,12 +269,12 @@ TFLiteCore::setOutputTensorProp ()
 int
 TFLiteCore::getTensorDim (int tensor_idx, tensor_dim dim)
 {
-  int len = interpreter->tensor (tensor_idx)->dims->size;
+  TfLiteIntArray *tensor_dims = interpreter->tensor (tensor_idx)->dims;
+  int len = tensor_dims->size;
   g_assert (len <= NNS_TENSOR_RANK_LIMIT);
 
   /* the order of dimension is reversed at CAPS negotiation */
-  std::reverse_copy (interpreter->tensor (tensor_idx)->dims->data,
-      interpreter->tensor (tensor_idx)->dims->data + len, dim);
+  std::reverse_copy (tensor_dims->data, tensor_dims->data + len, dim);
 
   /* fill the remnants with 1 */
   for (int i = len; i < NNS_TENSOR_RANK_LIMIT; ++i) {