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

Function TF_StringEncode

tensorflow/c/tf_tensor.cc:206–224  ·  view source on GitHub ↗

--------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

204
205// --------------------------------------------------------------------------
206size_t TF_StringEncode(const char* src, size_t src_len, char* dst,
207 size_t dst_len, TF_Status* status) {
208 const size_t sz = TF_StringEncodedSize(src_len);
209 if (sz < src_len) {
210 Set_TF_Status_from_Status(
211 status, InvalidArgument("src string is too large to encode"));
212 return 0;
213 }
214 if (dst_len < sz) {
215 Set_TF_Status_from_Status(
216 status,
217 InvalidArgument("dst_len (", dst_len, ") too small to encode a ",
218 src_len, "-byte string"));
219 return 0;
220 }
221 dst = tensorflow::core::EncodeVarint64(dst, src_len);
222 memcpy(dst, src, src_len);
223 return sz;
224}
225
226static Status TF_StringDecode_Impl(const char* src, size_t src_len,
227 const char** dst, size_t* dst_len) {

Callers 3

AddMethod · 0.85
TF_TensorFromTensorFunction · 0.85

Calls 4

TF_StringEncodedSizeFunction · 0.85
InvalidArgumentFunction · 0.85
EncodeVarint64Function · 0.85

Tested by

no test coverage detected