return -2;
}
- /* set allocation type to dynamic for in/out tensors */
+ /** set allocation type to dynamic for in/out tensors */
int tensor_idx;
- for (int i = 0; i < interpreter->inputs ().size (); i++) {
+ int tensorSize = interpreter->inputs ().size ();
+ for (int i = 0; i < tensorSize; ++i) {
tensor_idx = interpreter->inputs ()[i];
interpreter->tensor (tensor_idx)->allocation_type = kTfLiteDynamic;
}
- for (int i = 0; i < interpreter->outputs ().size (); i++) {
+ tensorSize = interpreter->outputs ().size ();
+ for (int i = 0; i < tensorSize; ++i) {
tensor_idx = interpreter->outputs ()[i];
interpreter->tensor (tensor_idx)->allocation_type = kTfLiteDynamic;
}
auto input_idx_list = interpreter->inputs ();
inputTensorMeta.num_tensors = input_idx_list.size ();
- for (int i = 0; i < inputTensorMeta.num_tensors; i++) {
+ for (int i = 0; i < inputTensorMeta.num_tensors; ++i) {
if (getTensorDim (input_idx_list[i], inputTensorMeta.info[i].dimension)) {
return -1;
}
auto output_idx_list = interpreter->outputs ();
outputTensorMeta.num_tensors = output_idx_list.size ();
- for (int i = 0; i < outputTensorMeta.num_tensors; i++) {
+ for (int i = 0; i < outputTensorMeta.num_tensors; ++i) {
if (getTensorDim (output_idx_list[i], outputTensorMeta.info[i].dimension)) {
return -1;
}
interpreter->tensor (tensor_idx)->dims->data + len, dim);
/* fill the remnants with 1 */
- for (int i = len; i < NNS_TENSOR_RANK_LIMIT; i++) {
+ for (int i = len; i < NNS_TENSOR_RANK_LIMIT; ++i) {
dim[i] = 1;
}
int tensor_idx;
TfLiteTensor *tensor_ptr;
- for (int i = 0; i < getOutputTensorSize (); i++) {
+ for (int i = 0; i < getOutputTensorSize (); ++i) {
tensor_idx = interpreter->outputs ()[i];
tensor_ptr = interpreter->tensor (tensor_idx);
tensors_idx.push_back (tensor_idx);
}
- for (int i = 0; i < getInputTensorSize (); i++) {
+ for (int i = 0; i < getInputTensorSize (); ++i) {
tensor_idx = interpreter->inputs ()[i];
tensor_ptr = interpreter->tensor (tensor_idx);
return -3;
}
- /* if it is not `nullptr`, tensorflow makes `free()` the memory itself. */
- for (int i = 0; i < tensors_idx.size (); i++) {
+ /** if it is not `nullptr`, tensorflow makes `free()` the memory itself. */
+ for (int i = 0; i < tensors_idx.size (); ++i) {
interpreter->tensor (tensors_idx[i])->data.raw = nullptr;
}