MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / StringValMaxBytesInProto

Function StringValMaxBytesInProto

tensorflow/core/debug/debug_io_utils.cc:118–124  ·  view source on GitHub ↗

Translates the length of a string to number of bytes when the string is encoded as bytes in protobuf. Note that this makes a conservative estimate (i.e., an estimate that is usually too large, but never too small under the gRPC message size limit) of the Varint-encoded length, to workaround the lack of a portable length function.

Source from the content-addressed store, hash-verified

116// gRPC message size limit) of the Varint-encoded length, to workaround the lack
117// of a portable length function.
118const size_t StringValMaxBytesInProto(const string& str) {
119#if defined(PLATFORM_GOOGLE)
120 return str.size() + DebugGrpcIO::kGrpcMaxVarintLengthSize;
121#else
122 return str.size();
123#endif
124}
125
126// Breaks a string Tensor (represented as a TensorProto) as a vector of Event
127// protos.

Callers 1

WrapStringTensorAsEventsFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected