| 1010 | } |
| 1011 | |
| 1012 | PyObject* AssertSameStructureForData(PyObject* o1, PyObject* o2, |
| 1013 | bool check_types) { |
| 1014 | string error_msg; |
| 1015 | bool is_type_error = false; |
| 1016 | AssertSameStructureHelper(o1, o2, check_types, &error_msg, &is_type_error, |
| 1017 | IsSequenceForDataHelper, GetValueIterator, false); |
| 1018 | if (PyErr_Occurred()) { |
| 1019 | // Don't hide Python exceptions while checking (e.g. errors fetching keys |
| 1020 | // from custom mappings). |
| 1021 | return nullptr; |
| 1022 | } |
| 1023 | if (!error_msg.empty()) { |
| 1024 | PyErr_SetString( |
| 1025 | is_type_error ? PyExc_TypeError : PyExc_ValueError, |
| 1026 | tensorflow::strings::StrCat( |
| 1027 | "The two structures don't have the same nested structure.\n\n", |
| 1028 | "First structure: ", PyObjectToString(o1), "\n\nSecond structure: ", |
| 1029 | PyObjectToString(o2), "\n\nMore specifically: ", error_msg) |
| 1030 | .c_str()); |
| 1031 | return nullptr; |
| 1032 | } |
| 1033 | Py_RETURN_NONE; |
| 1034 | } |
| 1035 | |
| 1036 | } // namespace swig |
| 1037 | } // namespace tensorflow |
nothing calls this directly
no test coverage detected