Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tensorflow_text/core/kernels/text_kernels_test_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ namespace text_kernels_test_util {

bool TensorEqMatcher::MatchAndExplain(
Tensor actual, ::testing::MatchResultListener* listener) const {
string expect_values = expect_.SummarizeValue(expect_.NumElements());
string actual_values = actual.SummarizeValue(actual.NumElements());
std::string expect_values = expect_.SummarizeValue(expect_.NumElements());
std::string actual_values = actual.SummarizeValue(actual.NumElements());
if (expect_.dtype() != actual.dtype() || expect_.shape() != actual.shape() ||
expect_values != actual_values) {
*listener << "\n dtype=" << DataTypeString(actual.dtype());
Expand Down
6 changes: 3 additions & 3 deletions tensorflow_text/core/kernels/text_kernels_test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ ::testing::Matcher<Tensor> TensorHasShapeAndValues(
// VectorEq<int64>({1, 2, 3, 4, 5, 6});
template <typename DTYPE>
::testing::Matcher<Tensor> VectorEq(const std::vector<DTYPE>& values) {
int64 nvals = values.size();
int64_t nvals = values.size();
Tensor expect = test::AsTensor<DTYPE>(values, {nvals});
// MakeMatcher takes ownership of the TensorEqMatcher.
return ::testing::MakeMatcher(new TensorEqMatcher(expect));
Expand All @@ -95,11 +95,11 @@ ::testing::Matcher<Tensor> VectorEq(const std::vector<DTYPE>& values) {
template <typename DTYPE>
::testing::Matcher<Tensor> MatrixEq(
const std::vector<std::vector<DTYPE>>& values) {
int64 nrows = values.size();
int64_t nrows = values.size();
CHECK_GT(nrows, 0) // Crash OK
<< "Invalid use of MatrixEq: to test empty matrices, use "
<< "TensorHasShapeAndValues<dtype>{{0, ndims}, {}} instead.";
int64 ncols = values[0].size();
int64_t ncols = values[0].size();
std::vector<DTYPE> flat;
for (const auto& row : values) {
CHECK_EQ(ncols, row.size()) // Crash OK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ class UnicodeScriptTokenizeWithOffsetsKernelTest

TEST_F(UnicodeScriptTokenizeWithOffsetsKernelTest, Test) {
MakeOp();
AddInputFromArray<int32>(TensorShape({6}), {111, 112, 32, 116, 117, 118});
AddInputFromArray<int64>(TensorShape({3}), {0, 4, 6});
AddInputFromArray<int32_t>(TensorShape({6}), {111, 112, 32, 116, 117, 118});
AddInputFromArray<int64_t>(TensorShape({3}), {0, 4, 6});
TF_ASSERT_OK(RunOpKernel());

std::vector<int32> expected_values({111, 112, 116, 117, 118});
std::vector<int64> expected_values_inner_splits({0, 2, 3, 5});
std::vector<int64> expected_offset_starts({0, 3, 0});
std::vector<int64> expected_offset_limits({2, 4, 2});
std::vector<int64> output_outer_splits({0, 2, 3});
std::vector<int32_t> expected_values({111, 112, 116, 117, 118});
std::vector<int64_t> expected_values_inner_splits({0, 2, 3, 5});
std::vector<int64_t> expected_offset_starts({0, 3, 0});
std::vector<int64_t> expected_offset_limits({2, 4, 2});
std::vector<int64_t> output_outer_splits({0, 2, 3});
EXPECT_THAT(*GetOutput(0), VectorEq(expected_values));
EXPECT_THAT(*GetOutput(1), VectorEq(expected_values_inner_splits));
EXPECT_THAT(*GetOutput(2), VectorEq(expected_offset_starts));
Expand Down
14 changes: 7 additions & 7 deletions tensorflow_text/core/kernels/whitespace_tokenize_kernel_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ class WhitespaceTokenizeWithOffsetsKernelTest

TEST_F(WhitespaceTokenizeWithOffsetsKernelTest, Test) {
MakeOp();
AddInputFromArray<int32>(TensorShape({6}), {111, 112, 32, 116, 117, 118});
AddInputFromArray<int64>(TensorShape({3}), {0, 4, 6});
AddInputFromArray<int32_t>(TensorShape({6}), {111, 112, 32, 116, 117, 118});
AddInputFromArray<int64_t>(TensorShape({3}), {0, 4, 6});
TF_ASSERT_OK(RunOpKernel());

std::vector<int32> expected_values({111, 112, 116, 117, 118});
std::vector<int64> expected_values_inner_splits({0, 2, 3, 5});
std::vector<int64> expected_offset_starts({0, 3, 0});
std::vector<int64> expected_offset_limits({2, 4, 2});
std::vector<int64> output_outer_splits({0, 2, 3});
std::vector<int32_t> expected_values({111, 112, 116, 117, 118});
std::vector<int64_t> expected_values_inner_splits({0, 2, 3, 5});
std::vector<int64_t> expected_offset_starts({0, 3, 0});
std::vector<int64_t> expected_offset_limits({2, 4, 2});
std::vector<int64_t> output_outer_splits({0, 2, 3});
EXPECT_THAT(*GetOutput(0), VectorEq(expected_values));
EXPECT_THAT(*GetOutput(1), VectorEq(expected_values_inner_splits));
EXPECT_THAT(*GetOutput(2), VectorEq(expected_offset_starts));
Expand Down