message: [tf.data] Disabling garbage collection of function graphs and in some cases, the function graph is collected prematurely.
diff: @@ -2803,15 +2803,8 @@ class StructuredFunctionWrapper(object):
  resource_tracker = tracking.ResourceTracker()
  with tracking.resource_tracker_scope(resource_tracker):
  - self._function = (
  - wrapper_fn._get_concrete_function_internal_garbage_collected())
  -
  - # TODO(jsimsa): Garbage collecting functions containing PyFunc nodes
  - # triggers use-after-free. Figure out why and stop excluding functions
  - # with PyFunc nodes from garbage collection.
  - for node in self._function.function_def.node_def:
  - if node.op in ("PyFunc", "PyFuncStateless", "EagerPyFunc"):
  - self._function._garbage_collector.release()
  + # TODO(b/141462134): Switch to using garbage collection.
  + self._function = wrapper_fn._get_concrete_function_internal()
  if add_to_graph:
  self._function.add_to_graph(ops.get_default_graph())
  