diff --git a/tensorflow/lite/kernels/test_util.cc b/tensorflow/lite/kernels/test_util.cc index 05ce059f0fd..0afef9f4122 100644 --- a/tensorflow/lite/kernels/test_util.cc +++ b/tensorflow/lite/kernels/test_util.cc @@ -112,10 +112,13 @@ int SingleOpModel::AddIntermediate(TensorType type, CreateQuantizationParameters(builder_, /*min=*/0, /*max=*/0, builder_.CreateVector(scale), builder_.CreateVector(zero_point)); - tensors_.push_back(CreateTensor(builder_, builder_.CreateVector({}), - type, - /*buffer=*/0, - /*name=*/0, q_params, false)); + tensors_.push_back( + CreateTensor(builder_, builder_.CreateVector({}), type, + /*buffer=*/0, + /*name=*/ + builder_.CreateString("Intermediate:" + + std::to_string(intermediates_.size())), + q_params, false)); intermediates_.push_back(id); return id; } diff --git a/tensorflow/lite/kernels/test_util.h b/tensorflow/lite/kernels/test_util.h index 7cc986ab483..63257b59b79 100644 --- a/tensorflow/lite/kernels/test_util.h +++ b/tensorflow/lite/kernels/test_util.h @@ -277,7 +277,8 @@ class SingleOpModel { tensors_.push_back(CreateTensor( builder_, builder_.CreateVector(t.shape), t.type, /*buffer=*/buffer_id, - /*name=*/0, /*quantization=*/0, /*is_variable=*/false, s_param)); + /*name=*/builder_.CreateString(std::to_string(tensors_.size())), + /*quantization=*/0, /*is_variable=*/false, s_param)); inputs_.push_back(id); tensor_data_[id] = t; @@ -361,11 +362,12 @@ class SingleOpModel { } } - tensors_.push_back( - CreateTensor(builder_, builder_.CreateVector(t.shape), - symmetric_quantize ? TensorType_INT8 : t.type, - /*buffer=*/buffer_id, - /*name=*/0, q_params, /*is_variable=*/false, s_param)); + tensors_.push_back(CreateTensor( + builder_, builder_.CreateVector(t.shape), + symmetric_quantize ? TensorType_INT8 : t.type, + /*buffer=*/buffer_id, + /*name=*/builder_.CreateString(std::to_string(tensors_.size())), + q_params, /*is_variable=*/false, s_param)); inputs_.push_back(id); tensor_data_[id] = t; @@ -683,7 +685,8 @@ class SingleOpModel { tensors_.push_back(CreateTensor( builder_, builder_.CreateVector(t.shape), t.type, /*buffer=*/buffer_id, - /*name=*/0, q_params, is_variable, + /*name=*/builder_.CreateString(std::to_string(tensors_.size())), + q_params, is_variable, /*sparsity=*/0, builder_.CreateVector(t.shape_signature))); tensor_data_[id] = t; @@ -797,10 +800,11 @@ class SingleOpModel { buffers_.push_back(CreateBuffer(builder_, data_buffer)); } - tensors_.push_back( - CreateTensor(builder_, builder_.CreateVector(t.shape), t.type, - /*buffer=*/buffer_id, - /*name=*/0, q_params, /*is_variable=*/false)); + tensors_.push_back(CreateTensor( + builder_, builder_.CreateVector(t.shape), t.type, + /*buffer=*/buffer_id, + /*name=*/builder_.CreateString(std::to_string(tensors_.size())), + q_params, /*is_variable=*/false)); tensor_data_[id] = t; return id; }