[tf.lite] Mark the tensor # as the tensor name for testing

For synthetic kernel tests, use the tensor index # as the tensor name to
simplify debugging.

PiperOrigin-RevId: 356411736
Change-Id: Id43f80f8d2416437e271bc3f72f5db42424a677a
This commit is contained in:
A. Unique TensorFlower 2021-02-08 19:55:51 -08:00 committed by TensorFlower Gardener
parent d3e7ce26d9
commit d61b9211bc
2 changed files with 15 additions and 22 deletions
tensorflow/lite/kernels

View File

@ -112,13 +112,10 @@ int SingleOpModel::AddIntermediate(TensorType type,
CreateQuantizationParameters(builder_, /*min=*/0, /*max=*/0,
builder_.CreateVector<float>(scale),
builder_.CreateVector<int64_t>(zero_point));
tensors_.push_back(
CreateTensor(builder_, builder_.CreateVector<int>({}), type,
/*buffer=*/0,
/*name=*/
builder_.CreateString("Intermediate:" +
std::to_string(intermediates_.size())),
q_params, false));
tensors_.push_back(CreateTensor(builder_, builder_.CreateVector<int>({}),
type,
/*buffer=*/0,
/*name=*/0, q_params, false));
intermediates_.push_back(id);
return id;
}

View File

@ -277,8 +277,7 @@ class SingleOpModel {
tensors_.push_back(CreateTensor(
builder_, builder_.CreateVector<int>(t.shape), t.type,
/*buffer=*/buffer_id,
/*name=*/builder_.CreateString(std::to_string(tensors_.size())),
/*quantization=*/0, /*is_variable=*/false, s_param));
/*name=*/0, /*quantization=*/0, /*is_variable=*/false, s_param));
inputs_.push_back(id);
tensor_data_[id] = t;
@ -362,12 +361,11 @@ class SingleOpModel {
}
}
tensors_.push_back(CreateTensor(
builder_, builder_.CreateVector<int>(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));
tensors_.push_back(
CreateTensor(builder_, builder_.CreateVector<int>(t.shape),
symmetric_quantize ? TensorType_INT8 : t.type,
/*buffer=*/buffer_id,
/*name=*/0, q_params, /*is_variable=*/false, s_param));
inputs_.push_back(id);
tensor_data_[id] = t;
@ -685,8 +683,7 @@ class SingleOpModel {
tensors_.push_back(CreateTensor(
builder_, builder_.CreateVector<int>(t.shape), t.type,
/*buffer=*/buffer_id,
/*name=*/builder_.CreateString(std::to_string(tensors_.size())),
q_params, is_variable,
/*name=*/0, q_params, is_variable,
/*sparsity=*/0, builder_.CreateVector<int>(t.shape_signature)));
tensor_data_[id] = t;
@ -800,11 +797,10 @@ class SingleOpModel {
buffers_.push_back(CreateBuffer(builder_, data_buffer));
}
tensors_.push_back(CreateTensor(
builder_, builder_.CreateVector<int>(t.shape), t.type,
/*buffer=*/buffer_id,
/*name=*/builder_.CreateString(std::to_string(tensors_.size())),
q_params, /*is_variable=*/false));
tensors_.push_back(
CreateTensor(builder_, builder_.CreateVector<int>(t.shape), t.type,
/*buffer=*/buffer_id,
/*name=*/0, q_params, /*is_variable=*/false));
tensor_data_[id] = t;
return id;
}