This function doesn't set the type of sequence before
| 3364 | |
| 3365 | // This function doesn't set the type of sequence before |
| 3366 | tensorflow::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 | |
| 3389 | tensorflow::Status TFE_Py_EncodeArgHelper(PyObject* arg, |
| 3390 | bool include_tensor_ranks_only, |
no test coverage detected