Skip to content

Commit

Permalink
Internal Code Change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 587763395
  • Loading branch information
tfx-copybara authored and iindyk committed Feb 26, 2024
1 parent d06c39c commit 58b253e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
1 change: 0 additions & 1 deletion struct2tensor/kernels/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ cc_library(
srcs = ["streaming_proto_reader.cc"],
hdrs = ["streaming_proto_reader.h"],
deps = [
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/base:endian",
"@com_google_absl//absl/strings",
"@com_google_protobuf//:protobuf",
Expand Down
1 change: 0 additions & 1 deletion struct2tensor/kernels/streaming_proto_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ limitations under the License.
==============================================================================*/
#include "struct2tensor/kernels/streaming_proto_reader.h"

#include "absl/base/integral_types.h"
#include "absl/strings/string_view.h"
#include "google/protobuf/wire_format_lite.h"
#include "tensorflow/core/lib/core/coding.h"
Expand Down
13 changes: 6 additions & 7 deletions struct2tensor/kernels/streaming_proto_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ limitations under the License.
//
// LOG and CHECK free.

#include "absl/base/integral_types.h"
#include "absl/base/internal/endian.h"
#include "absl/strings/string_view.h"
#include "google/protobuf/descriptor.h"
Expand Down Expand Up @@ -130,7 +129,7 @@ class PackedValuesReader {
// Utility function to parse message_set items. MessageSet item's wire format
// is equivalent to:
// repeated group Item {
// required int32 id = 2;
// required int32_t id = 2;
// required bytes value = 3;
// }
bool ParseMessageSetItem(absl::string_view msgset_item, int* id,
Expand All @@ -152,7 +151,7 @@ inline const char* VarintSkip32(const char* p) {
}

// Copied over from tensorflow/c/c_api.cc. However,
// using uint64_t instead of tensorflow::uint64.
// using uint64_t instead of tensorflow::uint64_t.
// This code can be deleted if/when tensorflow uses uint64_t.
// This avoids an unnecessary copy.
// See https://github.com/tensorflow/tensorflow/pull/21042
Expand Down Expand Up @@ -208,9 +207,9 @@ const char* SkipField(const char* ptr, const char* limit,
const char* SkipGroup(const char* ptr, const char* limit);

// Functions for decoding values from "raw" values. Raw data types are
// the following: uint32, uint64, StringPiece.
// Target value types are primitive values such as: int32, uint32, int64,
// uint64, bool, float, double, string, StringPiece and PackedValue.
// the following: uint32_t, uint64_t, StringPiece.
// Target value types are primitive values such as: int32_t, uint32_t, int64_t,
// uint64_t, bool, float, double, string, StringPiece and PackedValue.

inline void DecodeRawValue(uint32_t raw_value,
google::protobuf::FieldDescriptor::Type type,
Expand Down Expand Up @@ -345,7 +344,7 @@ inline const char*
ReadRawValue<google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT, uint32_t>(
const char* ptr, const char* limit, uint32_t* value) {
// Special case where negative values in this encoding are actually
// uint64 encoded as varint. So, decode uint64 and take first 4 bytes.
// uint64_t encoded as varint. So, decode uint64_t and take first 4 bytes.
uint64_t v;
const char* a = GetVarint64Ptr(ptr, limit, &v);
*value = static_cast<int32_t>(v);
Expand Down

0 comments on commit 58b253e

Please sign in to comment.