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

Function TFE_Py_EncodeSequence

tensorflow/python/eager/pywrap_tfe_src.cc:3366–3387  ·  view source on GitHub ↗

This function doesn't set the type of sequence before

Source from the content-addressed store, hash-verified

3364
3365// This function doesn't set the type of sequence before
3366tensorflow::Status TFE_Py_EncodeSequence(PyObject* arg, const char* type,
3367 const char* end_type,
3368 bool include_tensor_ranks_only,
3369 EncodeResult* result) {
3370 tensorflow::Safe_PyObjectPtr arg_seq(
3371 PySequence_Fast(arg, "unable to create seq from list/tuple"));
3372
3373 absl::StrAppend(&result->str, type);
3374 int len = PySequence_Fast_GET_SIZE(arg_seq.get());
3375 for (int i = 0; i < len; ++i) {
3376 PyObject* item = PySequence_Fast_GET_ITEM(arg_seq.get(), i);
3377 if (item == Py_None) {
3378 absl::StrAppend(&result->str, kNone);
3379 } else {
3380 TF_RETURN_IF_ERROR(
3381 TFE_Py_EncodeArgHelper(item, include_tensor_ranks_only, result));
3382 }
3383 }
3384 absl::StrAppend(&result->str, end_type);
3385
3386 return tensorflow::Status::OK();
3387}
3388
3389tensorflow::Status TFE_Py_EncodeArgHelper(PyObject* arg,
3390 bool include_tensor_ranks_only,

Callers 1

TFE_Py_EncodeArgHelperFunction · 0.85

Calls 3

TFE_Py_EncodeArgHelperFunction · 0.85
StrAppendFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected