[tf.data] Reimplement `tf.contrib.data.get_single_element()` as an async op.
The current `ToSingleElementOp` kernel has a synchronous implementation, and yet it can block an inter-op threadpool thread (in `iterator->GetNext()`) while depending on another (e.g. if the iterator calls a TensorFlow function to produce an element). This can lead to deadlock if the number of inter-op threadpool threads is less than or equal to the number of concurrent activations of that kernel. This change fixes that deadlock by moving the blocking computation onto a background thread. PiperOrigin-RevId: 179067816
Loading
Please sign in to comment