Fix typo, AddIntemediateTensorsToFusedOp to AddIntermediateTensorsToFusedOp.
PiperOrigin-RevId: 320276937 Change-Id: Ic6765880c25af50410c46f8f1ee164653b47a4ec
This commit is contained in:
parent
e242717155
commit
a22b28a22a
@ -27,7 +27,7 @@ bool CreateModelForCalibration(const std::string& input_path,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
flatbuffers::FlatBufferBuilder builder;
|
flatbuffers::FlatBufferBuilder builder;
|
||||||
if (AddIntemediateTensorsToFusedOp(&builder, &model) != kTfLiteOk) {
|
if (AddIntermediateTensorsToFusedOp(&builder, &model) != kTfLiteOk) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return WriteFile(output_path, builder.GetBufferPointer(), builder.GetSize());
|
return WriteFile(output_path, builder.GetBufferPointer(), builder.GetSize());
|
||||||
|
@ -66,7 +66,7 @@ TfLiteStatus LoadModel(const string& path, ModelT* model) {
|
|||||||
return kTfLiteOk;
|
return kTfLiteOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
TfLiteStatus AddIntemediateTensorsToFusedOp(
|
TfLiteStatus AddIntermediateTensorsToFusedOp(
|
||||||
flatbuffers::FlatBufferBuilder* builder, ModelT* model) {
|
flatbuffers::FlatBufferBuilder* builder, ModelT* model) {
|
||||||
// Return early if the model already has intermediate tensors.
|
// Return early if the model already has intermediate tensors.
|
||||||
if (IntermediateTensorExists(model)) {
|
if (IntermediateTensorExists(model)) {
|
||||||
|
@ -28,7 +28,7 @@ TfLiteStatus LoadModel(const string& path, ModelT* model);
|
|||||||
// Going through the model and add intermediates tensors if the ops have any.
|
// Going through the model and add intermediates tensors if the ops have any.
|
||||||
// Returns early if the model has already intermediate tensors. This is to
|
// Returns early if the model has already intermediate tensors. This is to
|
||||||
// support cases where a model is initialized multiple times.
|
// support cases where a model is initialized multiple times.
|
||||||
TfLiteStatus AddIntemediateTensorsToFusedOp(
|
TfLiteStatus AddIntermediateTensorsToFusedOp(
|
||||||
flatbuffers::FlatBufferBuilder* builder, ModelT* model);
|
flatbuffers::FlatBufferBuilder* builder, ModelT* model);
|
||||||
|
|
||||||
// Write model to a given location.
|
// Write model to a given location.
|
||||||
|
@ -59,7 +59,7 @@ TEST(LstmPreprocess, Add2Tensors) {
|
|||||||
|
|
||||||
// Add 2 tensors.
|
// Add 2 tensors.
|
||||||
flatbuffers::FlatBufferBuilder builder;
|
flatbuffers::FlatBufferBuilder builder;
|
||||||
tflite::optimize::AddIntemediateTensorsToFusedOp(&builder, model.get());
|
tflite::optimize::AddIntermediateTensorsToFusedOp(&builder, model.get());
|
||||||
|
|
||||||
// Verify results.
|
// Verify results.
|
||||||
EXPECT_EQ(model->operator_codes.size(), 1);
|
EXPECT_EQ(model->operator_codes.size(), 1);
|
||||||
@ -84,8 +84,8 @@ TEST(LstmPreprocess, Add2Tensors) {
|
|||||||
EXPECT_THAT(model->subgraphs[0]->operators[0]->intermediates,
|
EXPECT_THAT(model->subgraphs[0]->operators[0]->intermediates,
|
||||||
ElementsAreArray({21, 22, 23, 24, 25}));
|
ElementsAreArray({21, 22, 23, 24, 25}));
|
||||||
|
|
||||||
// Call AddIntemediateTensorsToFusedOp again and expect no change in model.
|
// Call AddIntermediateTensorsToFusedOp again and expect no change in model.
|
||||||
tflite::optimize::AddIntemediateTensorsToFusedOp(&builder, model.get());
|
tflite::optimize::AddIntermediateTensorsToFusedOp(&builder, model.get());
|
||||||
|
|
||||||
// Verify results.
|
// Verify results.
|
||||||
EXPECT_EQ(model->operator_codes.size(), 1);
|
EXPECT_EQ(model->operator_codes.size(), 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user