Support distributed dataset iteration within a tf.function for multiple workers. Refactor the get_next_as_optional code a little bit.
Support distributed dataset iteration within a tf.function for multiple workers. Refactor the get_next_as_optional code a little bit.

PiperOrigin-RevId: 328896281
Change-Id: I7d6775359cfc5374990bbdd8cf5ef7274ed3c8a3

paolodedios/tensorflow,tensorflow/tensorflow,sarvex/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,Intel-tensorflow/tensorflow,davidzchen/tensorflow,cxxgtxy/tensorflow,cxxgtxy/tensorflow,tensorflow/tensorflow,freedomtan/tensorflow,davidzchen/tensorflow,Intel-Corporation/tensorflow,Intel-Corporation/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,petewarden/tensorflow,frreiss/tensorflow-fred,cxxgtxy/tensorflow,freedomtan/tensorflow,Intel-Corporation/tensorflow,annarev/tensorflow,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,frreiss/tensorflow-fred,Intel-Corporation/tensorflow,freedomtan/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_saved_model,aldian/tensorflow,paolodedios/tensorflow,gautam1858/tensorflow,davidzchen/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow,aam-at/tensorflow,tensorflow/tensorflow-pywrap_saved_model,cxxgtxy/tensorflow,frreiss/tensorflow-fred,gautam1858/tensorflow,paolodedios/tensorflow,sarvex/tensorflow,gautam1858/tensorflow,sarvex/tensorflow,Intel-Corporation/tensorflow,cxxgtxy/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,davidzchen/tensorflow,paolodedios/tensorflow,freedomtan/tensorflow,freedomtan/tensorflow,paolodedios/tensorflow,petewarden/tensorflow,petewarden/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-tensorflow/tensorflow,annarev/tensorflow,gautam1858/tensorflow,aam-at/tensorflow,karllessard/tensorflow,annarev/tensorflow,gautam1858/tensorflow,aldian/tensorflow,yongtang/tensorflow,freedomtan/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,davidzchen/tensorflow,petewarden/tensorflow,freedomtan/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,petewarden/tensorflow,Intel-tensorflow/tensorflow,Intel-tensorflow/tensorflow,frreiss/tensorflow-fred,davidzchen/tensorflow,cxxgtxy/tensorflow,gautam1858/tensorflow,gautam1858/tensorflow,Intel-tensorflow/tensorflow,frreiss/tensorflow-fred,annarev/tensorflow,Intel-tensorflow/tensorflow,yongtang/tensorflow,aam-at/tensorflow,petewarden/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow-pywrap_saved_model,cxxgtxy/tensorflow,annarev/tensorflow,tensorflow/tensorflow,frreiss/tensorflow-fred,karllessard/tensorflow,Intel-Corporation/tensorflow,petewarden/tensorflow,annarev/tensorflow,sarvex/tensorflow,aldian/tensorflow,cxxgtxy/tensorflow,petewarden/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,gautam1858/tensorflow,annarev/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-tensorflow/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,aldian/tensorflow,davidzchen/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow,davidzchen/tensorflow,sarvex/tensorflow,sarvex/tensorflow,aam-at/tensorflow,aldian/tensorflow,aam-at/tensorflow,tensorflow/tensorflow-pywrap_saved_model,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,petewarden/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gautam1858/tensorflow,davidzchen/tensorflow,yongtang/tensorflow,frreiss/tensorflow-fred,aam-at/tensorflow,petewarden/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,yongtang/tensorflow,petewarden/tensorflow,annarev/tensorflow,yongtang/tensorflow,karllessard/tensorflow,aldian/tensorflow,karllessard/tensorflow,karllessard/tensorflow,aam-at/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_saved_model,annarev/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow,frreiss/tensorflow-fred,gautam1858/tensorflow,aam-at/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,sarvex/tensorflow,yongtang/tensorflow,annarev/tensorflow,freedomtan/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-Corporation/tensorflow,tensorflow/tensorflow,aam-at/tensorflow,petewarden/tensorflow,freedomtan/tensorflow,aam-at/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-Corporation/tensorflow,aam-at/tensorflow,frreiss/tensorflow-fred,frreiss/tensorflow-fred,karllessard/tensorflow,freedomtan/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,karllessard/tensorflow,yongtang/tensorflow,sarvex/tensorflow,aldian/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,paolodedios/tensorflow,aldian/tensorflow,tensorflow/tensorflow-pywrap_saved_model,yongtang/tensorflow,Intel-tensorflow/tensorflow,freedomtan/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-tensorflow/tensorflow,tensorflow/tensorflow,freedomtan/tensorflow,paolodedios/tensorflow,annarev/tensorflow,frreiss/tensorflow-fred,karllessard/tensorflow,karllessard/tensorflow,aam-at/tensorflow,davidzchen/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer