Qualify uses of std::string
PiperOrigin-RevId: 317000789 Change-Id: I6f847b235496d1dc8f8b3380e21ce890566a9a88
This commit is contained in:
parent
70e2387ecc
commit
adf0573f9d
tensorflow/lite/toco/graph_transformations/tests
@ -43,14 +43,15 @@ class FuseBinaryIntoFollowingAffineTest : public ::testing::Test {
|
||||
|
||||
void SetUp() override { model_.reset(new Model); }
|
||||
|
||||
void CreateArray(const string& name, const std::vector<int>& shape) {
|
||||
void CreateArray(const std::string& name, const std::vector<int>& shape) {
|
||||
Array& array = model_->GetOrCreateArray(name);
|
||||
array.data_type = ArrayDataType::kFloat;
|
||||
Shape* array_shape = array.mutable_shape();
|
||||
*(array_shape->mutable_dims()) = shape;
|
||||
}
|
||||
|
||||
void CreateConstantArray(const string& name, const std::vector<int>& shape,
|
||||
void CreateConstantArray(const std::string& name,
|
||||
const std::vector<int>& shape,
|
||||
const std::vector<float>& data) {
|
||||
CreateArray(name, shape);
|
||||
Array& array = model_->GetOrCreateArray(name);
|
||||
|
@ -43,14 +43,15 @@ class FuseBinaryIntoPrecedingAffineTest : public ::testing::Test {
|
||||
|
||||
void SetUp() override { model_.reset(new Model); }
|
||||
|
||||
void CreateArray(const string& name, const std::vector<int>& shape) {
|
||||
void CreateArray(const std::string& name, const std::vector<int>& shape) {
|
||||
Array& array = model_->GetOrCreateArray(name);
|
||||
array.data_type = ArrayDataType::kFloat;
|
||||
Shape* array_shape = array.mutable_shape();
|
||||
*(array_shape->mutable_dims()) = shape;
|
||||
}
|
||||
|
||||
void CreateConstantArray(const string& name, const std::vector<int>& shape,
|
||||
void CreateConstantArray(const std::string& name,
|
||||
const std::vector<int>& shape,
|
||||
const std::vector<float>& data) {
|
||||
CreateArray(name, shape);
|
||||
Array& array = model_->GetOrCreateArray(name);
|
||||
|
@ -46,12 +46,12 @@ class CopyArrayDataTest : public ::testing::Test {
|
||||
int src_dim_1, int src_dim_2,
|
||||
std::initializer_list<float> dst_data, int dst_dim_1,
|
||||
int dst_dim_2) {
|
||||
string src_array = "src_array";
|
||||
std::string src_array = "src_array";
|
||||
src_buffer_ = CreateFloatArrayBuffer(
|
||||
model, &src_array,
|
||||
src_dim_2 == 1 ? Shape({src_dim_1}) : Shape({src_dim_1, src_dim_2}));
|
||||
PopulateBuffer(src_buffer_, src_data);
|
||||
string dst_array = "dst_array";
|
||||
std::string dst_array = "dst_array";
|
||||
dst_buffer_ = CreateFloatArrayBuffer(
|
||||
model, &dst_array,
|
||||
dst_dim_2 == 1 ? Shape({dst_dim_1}) : Shape({dst_dim_1, dst_dim_2}));
|
||||
|
@ -107,10 +107,10 @@ class ResolveConstantConcatenationTest : public ::testing::Test {
|
||||
// together with 4 arrays as its inputs.
|
||||
// It receives the dimension of concatenation as input.
|
||||
void PrepareModel(Model* model, int axis) {
|
||||
const string output_name("concat_op_output");
|
||||
const std::string output_name("concat_op_output");
|
||||
model->flags.add_output_arrays(output_name);
|
||||
std::vector<string> concat_input_names = {"array0", "array1", "array2",
|
||||
"array3"};
|
||||
std::vector<std::string> concat_input_names = {"array0", "array1", "array2",
|
||||
"array3"};
|
||||
|
||||
const int kDim = 3;
|
||||
const int kElementPerDim = 2;
|
||||
@ -122,7 +122,7 @@ class ResolveConstantConcatenationTest : public ::testing::Test {
|
||||
{20., 21., 22., 23., 24., 25., 26., 27.},
|
||||
{30., 31., 32., 33., 34., 35., 36., 37.}};
|
||||
int cnt = 0;
|
||||
for (const string& concat_input_name : concat_input_names) {
|
||||
for (const std::string& concat_input_name : concat_input_names) {
|
||||
Array& in_array = model->GetOrCreateArray(concat_input_name);
|
||||
in_array.data_type = ArrayDataType::kFloat;
|
||||
|
||||
|
@ -40,10 +40,11 @@ class UnpackQuantizeTest : public ::testing::Test {
|
||||
// 1. calculate min and max of the input.
|
||||
// 2. insert dequantization nodes after quantized outputs of Unpack operation.
|
||||
void PrepareModel(Model* model, int axis) {
|
||||
std::vector<string> unpack_output_names = {"unpack_out0", "unpack_out1"};
|
||||
std::vector<std::string> unpack_output_names = {"unpack_out0",
|
||||
"unpack_out1"};
|
||||
model->flags.add_output_arrays(unpack_output_names[0]);
|
||||
model->flags.add_output_arrays(unpack_output_names[1]);
|
||||
const string unpack_input_name("unpack_op_input");
|
||||
const std::string unpack_input_name("unpack_op_input");
|
||||
|
||||
const int kDim = 2;
|
||||
const int kElementPerDim = 2;
|
||||
@ -75,7 +76,7 @@ class UnpackQuantizeTest : public ::testing::Test {
|
||||
// Configuring the necessary outputs. The outputs also happen to be in
|
||||
// kFloat. This is because during quantization transformation data types for
|
||||
// these arrays are going to be forced to be kUint8.
|
||||
for (const string& unpack_output_name : unpack_output_names) {
|
||||
for (const std::string& unpack_output_name : unpack_output_names) {
|
||||
Array& out_array = model->GetOrCreateArray(unpack_output_name);
|
||||
out_array.GetOrCreateMinMax();
|
||||
out_array.data_type = ArrayDataType::kFloat;
|
||||
@ -109,7 +110,7 @@ TEST_F(UnpackQuantizeTest, CheckUnpackPreservesQuantizationParameters) {
|
||||
->Run(&model, /*op_index=*/0, &modified)
|
||||
.ok());
|
||||
|
||||
const string output_name = model.flags.output_arrays(0);
|
||||
const std::string output_name = model.flags.output_arrays(0);
|
||||
|
||||
// Quantization transformation inserts NODE_NAME_DEQUANTIZE operations,
|
||||
// effectively making them the new outputs of the array. Old outputs of the
|
||||
|
Loading…
Reference in New Issue
Block a user