File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919
2020import tensorflow as tf , tf_keras
2121
22+ # pylint: disable=g-direct-tensorflow-import
23+ from tensorflow .python .tpu .google .sparse_core import tpu_embedding_v3
24+ # pylint: enable=g-direct-tensorflow-import
25+
2226
2327def create_loop_fn (step_fn ):
2428 """Creates a loop function driven by a Python `while` loop.
@@ -200,7 +204,8 @@ class LoopFnWithSummaries(tpu_summaries.OptionalSummariesFunction):
200204
201205 def __call__ (self , iterator , num_steps ):
202206 if tf .summary .should_record_summaries ():
203- output = self .with_summaries (iterator , tf .constant (1 ))
207+ with tpu_embedding_v3 .SequentialEmbeddingContext ():
208+ output = self .with_summaries (iterator , tf .constant (1 ))
204209 num_steps -= 1
205210 if num_steps >= 1 :
206211 output = self .without_summaries (iterator , num_steps )
You can’t perform that action at this time.
0 commit comments