Skip to content

Commit 4d96d0f

Browse files
lu-wang-gtflite-support-robot
authored andcommitted
Fix the Copybara issue when transform code from github
PiperOrigin-RevId: 398556595
1 parent 56ae103 commit 4d96d0f

File tree

8 files changed

+32
-19
lines changed

8 files changed

+32
-19
lines changed

tensorflow_lite_support/c/test/task/vision/image_classifier_test.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ using ::tflite::support::StatusOr;
3535
using ::tflite::task::JoinPath;
3636

3737
constexpr char kTestDataDirectory[] =
38-
"tensorflow_lite_support/cc/test/testdata/task/vision/";
38+
"/tensorflow_lite_support/cc/test/testdata/task/"
39+
"vision/";
3940
// Quantized model.
4041
constexpr char kMobileNetQuantizedWithMetadata[] =
4142
"mobilenet_v1_0.25_224_quant.tflite";

tensorflow_lite_support/cc/test/task/vision/image_classifier_test.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ using ::tflite::task::core::TaskAPIFactory;
5858
using ::tflite::task::core::TfLiteEngine;
5959

6060
constexpr char kTestDataDirectory[] =
61-
"tensorflow_lite_support/cc/test/testdata/task/vision/";
61+
"/tensorflow_lite_support/cc/test/testdata/task/"
62+
"vision/";
6263
// Float model.
6364
constexpr char kMobileNetFloatWithMetadata[] = "mobilenet_v2_1.0_224.tflite";
6465
// Quantized model.

tensorflow_lite_support/cc/test/task/vision/image_embedder_test.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ using ::tflite::support::TfLiteSupportStatus;
5050
using ::tflite::task::JoinPath;
5151

5252
constexpr char kTestDataDirectory[] =
53-
"tensorflow_lite_support/cc/test/testdata/task/vision/";
53+
"/tensorflow_lite_support/cc/test/testdata/task/"
54+
"vision/";
5455
// Test model. Float inputs, produces feature vectors that are not
5556
// L2-normalized as this model doesn't include a L2_NORMALIZATION TFLite Op.
5657
constexpr char kMobileNetV3[] = "mobilenet_v3_small_100_224_embedder.tflite";

tensorflow_lite_support/cc/test/task/vision/image_segmenter_test.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ using ::tflite::task::core::TaskAPIFactory;
5656
using ::tflite::task::core::TfLiteEngine;
5757

5858
constexpr char kTestDataDirectory[] =
59-
"tensorflow_lite_support/cc/test/testdata/task/vision/";
59+
"/tensorflow_lite_support/cc/test/testdata/task/"
60+
"vision/";
6061
constexpr char kDeepLabV3[] = "deeplabv3.tflite";
6162

6263
// All results returned by DeepLabV3 are expected to contain these in addition

tensorflow_lite_support/cc/test/task/vision/object_detector_test.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ using ::tflite::task::core::TaskAPIFactory;
7070
using ::tflite::task::core::TfLiteEngine;
7171

7272
constexpr char kTestDataDirectory[] =
73-
"tensorflow_lite_support/cc/test/testdata/task/vision/";
73+
"/tensorflow_lite_support/cc/test/testdata/task/"
74+
"vision/";
7475
constexpr char kMobileSsdWithMetadata[] =
7576
"coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.tflite";
7677
constexpr char kExpectResults[] =

tensorflow_lite_support/custom_ops/kernel/sentencepiece/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ cc_test(
273273
":encoder_config",
274274
":model_converter",
275275
":optimized_encoder",
276+
"//tensorflow_lite_support/cc/test:test_utils",
276277
"@com_google_absl//absl/flags:flag",
277278
"@com_google_absl//absl/status",
278279
"@com_google_absl//absl/strings:str_format",
@@ -296,6 +297,7 @@ cc_test(
296297
":double_array_trie_builder",
297298
":model_converter",
298299
":optimized_decoder",
300+
"//tensorflow_lite_support/cc/test:test_utils",
299301
"@com_google_absl//absl/flags:flag",
300302
"@com_google_absl//absl/status",
301303
"@com_google_absl//absl/strings:str_format",

tensorflow_lite_support/custom_ops/kernel/sentencepiece/optimized_decoder_test.cc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ limitations under the License.
2424
#include "external/com_google_sentencepiece/src/sentencepiece.pb.h"
2525
#include "external/com_google_sentencepiece/src/sentencepiece_processor.h"
2626
#include "tensorflow/core/platform/env.h"
27+
#include "tensorflow_lite_support/cc/test/test_utils.h"
2728
#include "tensorflow_lite_support/custom_ops/kernel/sentencepiece/model_converter.h"
2829

2930
namespace tflite {
@@ -35,9 +36,8 @@ namespace internal {
3536

3637
tensorflow::Status TFReadFileToString(const std::string& filepath,
3738
std::string* data) {
38-
return tensorflow::ReadFileToString(
39-
tensorflow::Env::Default(), /*test_path*/ filepath,
40-
data);
39+
return tensorflow::ReadFileToString(tensorflow::Env::Default(), filepath,
40+
data);
4141
}
4242

4343
absl::Status StdReadFileToString(const std::string& filepath,
@@ -57,14 +57,17 @@ absl::Status StdReadFileToString(const std::string& filepath,
5757
} // namespace internal
5858

5959
namespace {
60+
using ::tflite::task::JoinPath;
61+
6062
static char kConfigFilePath[] =
61-
"tensorflow_lite_support/custom_ops/kernel/"
63+
"/tensorflow_lite_support/custom_ops/kernel/"
6264
"sentencepiece/testdata/sentencepiece.model";
6365

6466
TEST(OptimizedEncoder, ConfigConverter) {
6567
std::string config;
66-
auto status = internal::StdReadFileToString(kConfigFilePath, &config);
6768

69+
auto status = internal::StdReadFileToString(
70+
JoinPath("./" /*test src dir*/, kConfigFilePath), &config);
6871
ASSERT_TRUE(status.ok());
6972

7073
::sentencepiece::SentencePieceProcessor processor;

tensorflow_lite_support/custom_ops/kernel/sentencepiece/optimized_encoder_test.cc

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ limitations under the License.
2525
#include "external/com_google_sentencepiece/src/sentencepiece.pb.h"
2626
#include "external/com_google_sentencepiece/src/sentencepiece_processor.h"
2727
#include "tensorflow/core/platform/env.h"
28+
#include "tensorflow_lite_support/cc/test/test_utils.h"
2829
#include "tensorflow_lite_support/custom_ops/kernel/sentencepiece/double_array_trie_builder.h"
2930
#include "tensorflow_lite_support/custom_ops/kernel/sentencepiece/encoder_config_generated.h"
3031
#include "tensorflow_lite_support/custom_ops/kernel/sentencepiece/model_converter.h"
@@ -36,15 +37,14 @@ namespace sentencepiece {
3637

3738
namespace internal {
3839

39-
tensorflow::Status TFReadFileToString(
40-
const std::string& filepath, std::string* data) {
41-
return tensorflow::ReadFileToString(
42-
tensorflow::Env::Default(), /*test_path*/ filepath,
43-
data);
40+
tensorflow::Status TFReadFileToString(const std::string& filepath,
41+
std::string* data) {
42+
return tensorflow::ReadFileToString(tensorflow::Env::Default(), filepath,
43+
data);
4444
}
4545

46-
absl::Status StdReadFileToString(
47-
const std::string& filepath, std::string* data) {
46+
absl::Status StdReadFileToString(const std::string& filepath,
47+
std::string* data) {
4848
std::ifstream infile(filepath);
4949
if (!infile.is_open()) {
5050
return absl::NotFoundError(
@@ -60,8 +60,10 @@ absl::Status StdReadFileToString(
6060

6161
namespace {
6262

63+
using ::tflite::task::JoinPath;
64+
6365
static char kConfigFilePath[] =
64-
"tensorflow_lite_support/custom_ops/kernel/"
66+
"/tensorflow_lite_support/custom_ops/kernel/"
6567
"sentencepiece/testdata/sentencepiece.model";
6668

6769
TEST(OptimizedEncoder, NormalizeStringWhitestpaces) {
@@ -147,7 +149,8 @@ TEST(OptimizedEncoder, NormalizeStringWhitespacesRemove) {
147149

148150
TEST(OptimizedEncoder, ConfigConverter) {
149151
std::string config;
150-
auto status = internal::StdReadFileToString(kConfigFilePath, &config);
152+
auto status = internal::StdReadFileToString(
153+
JoinPath("./" /*test src dir*/, kConfigFilePath), &config);
151154
ASSERT_TRUE(status.ok());
152155

153156
::sentencepiece::SentencePieceProcessor processor;

0 commit comments

Comments
 (0)