diff --git a/tensorflow/python/saved_model/function_deserialization.py b/tensorflow/python/saved_model/function_deserialization.py index e8a9514dd56..9fcffc8ccdf 100644 --- a/tensorflow/python/saved_model/function_deserialization.py +++ b/tensorflow/python/saved_model/function_deserialization.py @@ -93,16 +93,6 @@ def _concrete_function_callable_with(function, inputs, allow_conversion): flatten_inputs = nest.flatten_up_to(expected_structure, inputs) except (TypeError, ValueError): return False - try: - # Verify that no input elements were dropped during flattening. - repacked = nest.pack_sequence_as(expected_structure, flatten_inputs) - # TODO(b/129422719): Namedtuple subclasses re-created through - # saved_model.load don't compare equal in type to the original in - # assert_same_structure. Fix that and we can take out check_types=False - # here. - nest.assert_same_structure(inputs, repacked, check_types=False) - except (TypeError, ValueError): - return False for arg, expected in zip(flatten_inputs, nest.flatten(expected_structure)): if isinstance(expected, tensor_spec.TensorSpec): diff --git a/tensorflow/python/util/util.cc b/tensorflow/python/util/util.cc index 6da3fdbf945..1d0dd695d74 100644 --- a/tensorflow/python/util/util.cc +++ b/tensorflow/python/util/util.cc @@ -730,9 +730,9 @@ bool AssertSameStructureHelper( // We treat two different namedtuples with identical name and fields // as having the same type. - const PyObject* o1_tuple = IsNamedtuple(o1, true); + const PyObject* o1_tuple = IsNamedtuple(o1, false); if (o1_tuple == nullptr) return false; - const PyObject* o2_tuple = IsNamedtuple(o2, true); + const PyObject* o2_tuple = IsNamedtuple(o2, false); if (o2_tuple == nullptr) { Py_DECREF(o1_tuple); return false;