Skip to content

Commit

Permalink
Fix transformations to the TFLite transforms.bara.sky file for LiteRT…
Browse files Browse the repository at this point in the history
… path

PiperOrigin-RevId: 700409539
  • Loading branch information
ecalubaquib authored and copybara-github committed Nov 26, 2024
1 parent 79ee362 commit a0c8a61
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 43 deletions.
10 changes: 5 additions & 5 deletions tflite/c/c_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static void TestVersion(void) {

static void TestInferenceUsingSignature(void) {
TfLiteModel* model = TfLiteModelCreateFromFile(
"third_party/tensorflow/lite/testdata/multi_signatures.bin");
"tflite/testdata/multi_signatures.bin");
ASSERT_NE(model, NULL);

TfLiteInterpreterOptions* options = TfLiteInterpreterOptionsCreate();
Expand Down Expand Up @@ -154,7 +154,7 @@ static void TestInferenceUsingSignature(void) {
// would invalidate input/output tensors.
static void TestRepeatResizeInputTensor(void) {
TfLiteModel* model = TfLiteModelCreateFromFile(
"third_party/tensorflow/lite/testdata/multi_signatures.bin");
"tflite/testdata/multi_signatures.bin");
ASSERT_NE(model, NULL);

TfLiteInterpreterOptions* options = TfLiteInterpreterOptionsCreate();
Expand Down Expand Up @@ -236,7 +236,7 @@ static void TestRepeatResizeInputTensor(void) {

static void TestInferenceUsingInterpreter(void) {
TfLiteModel* model =
TfLiteModelCreateFromFile("third_party/tensorflow/lite/testdata/add.bin");
TfLiteModelCreateFromFile("tflite/testdata/add.bin");
ASSERT_NE(model, NULL);

TfLiteInterpreterOptions* options = TfLiteInterpreterOptionsCreate();
Expand Down Expand Up @@ -321,7 +321,7 @@ TfLiteStatus PrepareThatChecksExecutionPlanSizeEqualsTwo(

static void TestTfLiteOpaqueContextGetExecutionPlan(void) {
TfLiteModel* model =
TfLiteModelCreateFromFile("third_party/tensorflow/lite/testdata/add.bin");
TfLiteModelCreateFromFile("tflite/testdata/add.bin");

// Create and install a delegate instance.
bool delegate_prepared = false;
Expand All @@ -348,7 +348,7 @@ static void TestTfLiteOpaqueContextReportErrorMacros(
TfLiteStatus (*Prepare)(TfLiteOpaqueContext* context,
TfLiteOpaqueDelegate* delegate, void* data)) {
TfLiteModel* model =
TfLiteModelCreateFromFile("third_party/tensorflow/lite/testdata/add.bin");
TfLiteModelCreateFromFile("tflite/testdata/add.bin");

// Create and install a delegate instance.
bool delegate_prepared_called = false;
Expand Down
2 changes: 1 addition & 1 deletion tflite/core/tools/verifier_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace tflite {

namespace {
static const char* kSparseTensorTestModel =
"tensorflow/lite/testdata/sparse_tensor.bin";
"tflite/testdata/sparse_tensor.bin";
} // namespace

class MockErrorReporter : public ErrorReporter {
Expand Down
20 changes: 10 additions & 10 deletions tflite/delegates/opaque_delegate_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ TEST_F(TestOpaqueMacros, TF_LITE_OPAQUE_ENSURE_REPORTS) {
};
EnsureDelegationFails();
const std::string txt_regex(
".*third_party/tensorflow/lite/delegates/"
".*tflite/delegates/"
"opaque_delegate_test\\.cc.*false was not true.*");
#ifndef TF_LITE_STRIP_ERROR_STRINGS
EXPECT_THAT(reporter_.error_messages(), ContainsRegex(txt_regex));
Expand All @@ -246,7 +246,7 @@ TEST_F(TestOpaqueMacros, TF_LITE_OPAQUE_ENSURE_SILENT) {
};
EnsureDelegationSucceeds();
const std::string txt_regex(
".*third_party/tensorflow/lite/delegates/"
".*tflite/delegates/"
"opaque_delegate_test\\.cc.*was not true.*");
EXPECT_THAT(reporter_.error_messages(), Not(ContainsRegex(txt_regex)));
}
Expand All @@ -259,7 +259,7 @@ TEST_F(TestOpaqueMacros, TF_LITE_OPAQUE_ENSURE_EQ_REPORTS) {
};
EnsureDelegationFails();
const std::string txt_regex(
".*third_party/tensorflow/lite/delegates/"
".*tflite/delegates/"
"opaque_delegate_test\\.cc.*true != false.*");
#ifndef TF_LITE_STRIP_ERROR_STRINGS
EXPECT_THAT(reporter_.error_messages(), ContainsRegex(txt_regex));
Expand All @@ -276,7 +276,7 @@ TEST_F(TestOpaqueMacros, TF_LITE_OPAQUE_ENSURE_EQ_SILENT) {
};
EnsureDelegationSucceeds();
const std::string txt_regex(
".*third_party/tensorflow/lite/delegates/"
".*tflite/delegates/"
"opaque_delegate_test\\.cc.* != *");
EXPECT_THAT(reporter_.error_messages(), Not(ContainsRegex(txt_regex)));
}
Expand All @@ -289,7 +289,7 @@ TEST_F(TestOpaqueMacros, TF_LITE_OPAQUE_ENSURE_MSG_REPORTS) {
};
EnsureDelegationFails();
const std::string txt_regex(
".*third_party/tensorflow/lite/delegates/"
".*tflite/delegates/"
"opaque_delegate_test\\.cc.*custom error msg.*");
#ifndef TF_LITE_STRIP_ERROR_STRINGS
EXPECT_THAT(reporter_.error_messages(), ContainsRegex(txt_regex));
Expand All @@ -306,7 +306,7 @@ TEST_F(TestOpaqueMacros, TF_LITE_OPAQUE_ENSURE_MSG_SILENT) {
};
EnsureDelegationSucceeds();
const std::string txt_regex(
".*third_party/tensorflow/lite/delegates/"
".*tflite/delegates/"
"opaque_delegate_test\\.cc.*");
EXPECT_THAT(reporter_.error_messages(), Not(ContainsRegex(txt_regex)));
}
Expand All @@ -320,7 +320,7 @@ TEST_F(TestOpaqueMacros, TF_LITE_OPAQUE_ENSURE_TYPES_EQ_REPORTS) {
};
EnsureDelegationFails();
const std::string txt_regex(
".*third_party/tensorflow/lite/delegates/"
".*tflite/delegates/"
"opaque_delegate_test\\.cc.*kTfLiteFloat32 != kTfLiteInt32.*");
#ifndef TF_LITE_STRIP_ERROR_STRINGS
EXPECT_THAT(reporter_.error_messages(), ContainsRegex(txt_regex));
Expand All @@ -338,7 +338,7 @@ TEST_F(TestOpaqueMacros, TF_LITE_OPAQUE_ENSURE_TYPES_EQ_SILENT) {
};
EnsureDelegationSucceeds();
const std::string txt_regex(
".*third_party/tensorflow/lite/delegates/"
".*tflite/delegates/"
"opaque_delegate_test\\.cc.*!=.*");
EXPECT_THAT(reporter_.error_messages(), Not(ContainsRegex(txt_regex)));
}
Expand All @@ -351,7 +351,7 @@ TEST_F(TestOpaqueMacros, TF_LITE_OPAQUE_ENSURE_NEAR_REPORTS) {
};
EnsureDelegationFails();
const std::string txt_regex(
".*third_party/tensorflow/lite/delegates/"
".*tflite/delegates/"
"opaque_delegate_test\\.cc.*1 not near 10.*");
#ifndef TF_LITE_STRIP_ERROR_STRINGS
EXPECT_THAT(reporter_.error_messages(), ContainsRegex(txt_regex));
Expand All @@ -368,7 +368,7 @@ TEST_F(TestOpaqueMacros, TF_LITE_OPAQUE_ENSURE_NEAR_SILENT) {
};
EnsureDelegationSucceeds();
const std::string txt_regex(
".*third_party/tensorflow/lite/delegates/"
".*tflite/delegates/"
"opaque_delegate_test\\.cc.*10 not near 10.*");
EXPECT_THAT(reporter_.error_messages(), Not(ContainsRegex(txt_regex)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ genrule(
echo '
{
"stable_delegate_loader_settings": {
"delegate_path": "tensorflow/lite/delegates/utils/experimental/sample_stable_delegate/libtensorflowlite_sample_stable_delegate.so"
"delegate_path": "tflite/delegates/utils/experimental/sample_stable_delegate/libtensorflowlite_sample_stable_delegate.so"
}
}
' > $@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int main(int argc, char* argv[]) {
// Load the example stable delegate plugin from a shared library file.
const TfLiteStableDelegate* stable_delegate_handle =
LoadDelegateFromSharedLibrary(
"tensorflow/lite/delegates/utils/experimental/"
"tflite/delegates/utils/experimental/"
"sample_stable_delegate/libtensorflowlite_sample_stable_delegate.so");
CHECK(stable_delegate_handle != nullptr);

Expand Down
4 changes: 2 additions & 2 deletions tflite/java/aar_with_jni.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ cd $$(mktemp -d)
unzip $$origdir/$(location :{1}_dummy_app_for_so_unsigned.apk) "lib/*"
cp -r lib jni
zip -r $$origdir/$(location :{1}.aar) jni/*/*.so
cp $$origdir/$(location @org_tensorflow//:LICENSE) ./
cp $$origdir/$(location @org_tensorflow//tensorflow:LICENSE) ./
zip $$origdir/$(location :{1}.aar) LICENSE
""".format(android_library, name)

Expand Down Expand Up @@ -128,7 +128,7 @@ cp $(location {0}.aar) $(location :{1}.aar)
chmod +w $(location :{1}.aar)
origdir=$$PWD
cd $$(mktemp -d)
cp $$origdir/$(location @org_tensorflow//:LICENSE) ./
cp $$origdir/$(location @org_tensorflow//tensorflow:LICENSE) ./
zip $$origdir/$(location :{1}.aar) LICENSE
""".format(android_library, name)

Expand Down
8 changes: 4 additions & 4 deletions tflite/testing/tflite_driver_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ using ::testing::ElementsAre;
TEST(TfliteDriverTest, SimpleTest) {
std::unique_ptr<TestRunner> runner(new TfLiteDriver);

runner->SetModelBaseDir("third_party/tensorflow/lite");
runner->SetModelBaseDir("tflite");
runner->LoadModel("testdata/multi_add.bin", "serving_default");
ASSERT_TRUE(runner->IsValid());

Expand Down Expand Up @@ -62,7 +62,7 @@ TEST(TfliteDriverTest, SingleAddOpTest) {
/*delegate_type=*/TfLiteDriver::DelegateType::kNone,
/*reference_kernel=*/true));

runner->SetModelBaseDir("third_party/tensorflow/lite");
runner->SetModelBaseDir("tflite");
runner->LoadModel("testdata/multi_add.bin");
ASSERT_TRUE(runner->IsValid());

Expand Down Expand Up @@ -91,7 +91,7 @@ TEST(TfliteDriverTest, AddOpWithNaNTest) {
/*delegate_type=*/TfLiteDriver::DelegateType::kNone,
/*reference_kernel=*/true));

runner->SetModelBaseDir("third_party/tensorflow/lite");
runner->SetModelBaseDir("tflite");
runner->LoadModel("testdata/multi_add.bin");
ASSERT_TRUE(runner->IsValid());

Expand Down Expand Up @@ -119,7 +119,7 @@ TEST(TfliteDriverTest, AddOpWithNaNTest) {
TEST(TfliteDriverTest, AddQuantizedInt8Test) {
std::unique_ptr<TestRunner> runner(new TfLiteDriver());

runner->SetModelBaseDir("third_party/tensorflow/lite");
runner->SetModelBaseDir("tflite");
runner->LoadModel("testdata/add_quantized_int8.bin");
ASSERT_TRUE(runner->IsValid());

Expand Down
4 changes: 2 additions & 2 deletions tflite/toco/toco_port_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ namespace port {
namespace {

#ifdef PLATFORM_GOOGLE
#define TFLITE_PREFIX "tflite/"
#define TFLITE_PREFIX "third_party/tensorflow/lite/"
#else
#define TFLITE_PREFIX "tensorflow/lite/"
#define TFLITE_PREFIX "tflite/"
#endif

TEST(TocoPortTest, Exists) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
{
"delegate": "NONE",
"stable_delegate_loader_settings": {
"delegate_path": "tensorflow/lite/delegates/utils/experimental/sample_stable_delegate/libtensorflowlite_sample_stable_delegate.so"
"delegate_path": "tflite/delegates/utils/experimental/sample_stable_delegate/libtensorflowlite_sample_stable_delegate.so"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"delegate": "XNNPACK",
"stable_delegate_loader_settings": {
"delegate_path": "tensorflow/lite/delegates/utils/experimental/stable_delegate/libtensorflowlite_stable_xnnpack_delegate.so"
"delegate_path": "tflite/delegates/utils/experimental/stable_delegate/libtensorflowlite_stable_xnnpack_delegate.so"
},
"xnnpack_settings": {
"num_threads": 5
Expand Down
16 changes: 8 additions & 8 deletions tflite/tools/list_flex_ops_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,38 +87,38 @@ class FlexOpModel : public SingleOpModel {
};

TEST_F(FlexOpsListTest, TestModelsNoFlex) {
ReadOps("tensorflow/lite/testdata/test_model.bin");
ReadOps("tflite/testdata/test_model.bin");
EXPECT_EQ(output_text_, "[]\n");
}

TEST_F(FlexOpsListTest, TestBrokenModel) {
EXPECT_DEATH_IF_SUPPORTED(
ReadOps("tensorflow/lite/testdata/test_model_broken.bin"), "");
ReadOps("tflite/testdata/test_model_broken.bin"), "");
}

TEST_F(FlexOpsListTest, TestZeroSubgraphs) {
ReadOps("tensorflow/lite/testdata/0_subgraphs.bin");
ReadOps("tflite/testdata/0_subgraphs.bin");
EXPECT_EQ(output_text_, "[]\n");
}

TEST_F(FlexOpsListTest, TestFlexAdd) {
ReadOps("tensorflow/lite/testdata/multi_add_flex.bin");
ReadOps("tflite/testdata/multi_add_flex.bin");
EXPECT_EQ(output_text_,
"[[\"AddV2\",\"BinaryOp<CPUDevice, functor::add<float>>\"]]\n");
}

TEST_F(FlexOpsListTest, TestTwoModel) {
ReadOps("tensorflow/lite/testdata/multi_add_flex.bin");
ReadOps("tensorflow/lite/testdata/softplus_flex.bin");
ReadOps("tflite/testdata/multi_add_flex.bin");
ReadOps("tflite/testdata/softplus_flex.bin");
EXPECT_EQ(output_text_,
"[[\"AddV2\",\"BinaryOp<CPUDevice, "
"functor::add<float>>\"],[\"Softplus\",\"SoftplusOp<CPUDevice, "
"float>\"]]\n");
}

TEST_F(FlexOpsListTest, TestDuplicatedOp) {
ReadOps("tensorflow/lite/testdata/multi_add_flex.bin");
ReadOps("tensorflow/lite/testdata/multi_add_flex.bin");
ReadOps("tflite/testdata/multi_add_flex.bin");
ReadOps("tflite/testdata/multi_add_flex.bin");
EXPECT_EQ(output_text_,
"[[\"AddV2\",\"BinaryOp<CPUDevice, functor::add<float>>\"]]\n");
}
Expand Down
4 changes: 2 additions & 2 deletions tflite/tools/optimize/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ tf_cc_test(
name = "quantization_utils_test",
srcs = ["quantization_utils_test.cc"],
args = [
"--test_model_file=$(location //tensorflow/compiler/mlir/lite/quantization/lite:testdata/single_conv_weights_min_0_max_plus_10.bin)",
"--test_model_file=$(location @org_tensorflow//tensorflow/compiler/mlir/lite/quantization/lite:testdata/single_conv_weights_min_0_max_plus_10.bin)",
],
data = [
"@org_tensorflow//tensorflow/compiler/mlir/lite/quantization/lite:testdata/single_conv_weights_min_0_max_plus_10.bin",
Expand Down Expand Up @@ -282,7 +282,7 @@ tf_cc_test(
name = "quantize_model_test",
srcs = ["quantize_model_test.cc"],
args = [
"--test_model_file=$(location //tensorflow/compiler/mlir/lite/quantization/lite:testdata/single_conv_weights_min_0_max_plus_10.bin)",
"--test_model_file=$(location @org_tensorflow//tensorflow/compiler/mlir/lite/quantization/lite:testdata/single_conv_weights_min_0_max_plus_10.bin)",
],
data = [
"@org_tensorflow//tensorflow/compiler/mlir/lite/quantization/lite:testdata/add_with_const_input.bin",
Expand Down
6 changes: 3 additions & 3 deletions tflite/tools/versioning/gpu_compatibility_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ absl::Status CheckGpuDelegateCompatibility(const tflite::Model* model) {

TEST(CheckGpuDelegateCompatibility, Conv2DModel) {
const std::string& full_path = tensorflow::GetDataDependencyFilepath(
"tensorflow/lite/testdata/conv_huge_im2col.bin");
"tflite/testdata/conv_huge_im2col.bin");
auto model = FlatBufferModel::BuildFromFile(full_path.data());
ASSERT_TRUE(model);
EXPECT_TRUE(CheckGpuDelegateCompatibility(model->GetModel()).ok());
}

TEST(CheckGpuDelegateCompatibility, Conv3DModel) {
const std::string& full_path = tensorflow::GetDataDependencyFilepath(
"tensorflow/lite/testdata/conv3d_huge_im2col.bin");
"tflite/testdata/conv3d_huge_im2col.bin");
auto model = FlatBufferModel::BuildFromFile(full_path.data());
ASSERT_TRUE(model);
EXPECT_EQ(CheckGpuDelegateCompatibility(model->GetModel()).message(),
Expand All @@ -74,7 +74,7 @@ TEST(CheckGpuDelegateCompatibility, Conv3DModel) {

TEST(CheckGpuDelegateCompatibility, FlexModel) {
const std::string& full_path = tensorflow::GetDataDependencyFilepath(
"tensorflow/lite/testdata/multi_add_flex.bin");
"tflite/testdata/multi_add_flex.bin");
auto model = FlatBufferModel::BuildFromFile(full_path.data());
ASSERT_TRUE(model);
EXPECT_EQ(CheckGpuDelegateCompatibility(model->GetModel()).message(),
Expand Down
4 changes: 2 additions & 2 deletions tflite/tools/versioning/op_signature_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class StubTfLiteContext : public TfLiteContext {

TEST(GetOpSignature, FlatBufferModel) {
const std::string& full_path =
tensorflow::GetDataDependencyFilepath("tensorflow/lite/testdata/add.bin");
tensorflow::GetDataDependencyFilepath("tflite/testdata/add.bin");
auto fb_model = FlatBufferModel::BuildFromFile(full_path.data());
ASSERT_TRUE(fb_model);
auto model = fb_model->GetModel();
Expand Down Expand Up @@ -177,7 +177,7 @@ TEST(GetOpSignature, FlatBufferModel) {
free(op_sig.builtin_data);

const std::string& full_path3 = tensorflow::GetDataDependencyFilepath(
"tensorflow/lite/testdata/multi_signatures.bin");
"tflite/testdata/multi_signatures.bin");
auto fb_model3 = FlatBufferModel::BuildFromFile(full_path3.data());
ASSERT_TRUE(fb_model3);
auto model3 = fb_model3->GetModel();
Expand Down

0 comments on commit a0c8a61

Please sign in to comment.