{"record":{"id":"adf4c48ab3cb34ca","repo":"tensorflow/models","slug":"use-tpu-summary-optimization-true-and-use-tf-wh","errorCode":null,"errorMessage":"`use_tpu_summary_optimization=True` and `use_tf_while_loop=False` is not supported","messagePattern":"`use_tpu_summary_optimization=True` and `use_tf_while_loop=False` is not supported","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"orbit/standard_runner.py","lineNumber":101,"sourceCode":"  `tf.function`, as determined by the `options` passed to `__init__`.\n  \"\"\"\n\n  def __init__(self,\n               train_dataset,\n               options: Optional[StandardTrainerOptions] = None):\n    \"\"\"Initializes the `StandardTrainer` instance.\n\n    Args:\n      train_dataset: A `tf.nest`-compatible structure of `tf.data.Dataset` or\n        `DistributedDataset`.\n      options: An `orbit.StandardTrainerOptions` instance.\n    \"\"\"\n    options = options or StandardTrainerOptions()\n    if options.use_tf_while_loop and not options.use_tf_function:\n      raise ValueError(\"`use_tf_while_loop=True` and `use_tf_function=False` \"\n                       \"is not supported\")\n    if options.use_tpu_summary_optimization and not options.use_tf_while_loop:\n      raise ValueError(\"`use_tpu_summary_optimization=True` and \"\n                       \"`use_tf_while_loop=False` is not supported\")\n\n    self._train_options = options\n    self._train_dataset = train_dataset\n    self._train_iter = None\n    self._train_loop_fn = None\n\n  def create_train_loop_fn(self):\n    \"\"\"Creates a training loop from the current step function and options.\n\n    Returns:\n      The train loop function, i.e. wrapper of multiple train steps.\n    \"\"\"\n    train_step_fn = self.train_step\n    if self._train_options.use_tf_while_loop:\n      loop_fn = loop_fns.create_tf_while_loop_fn(train_step_fn)\n      if self._train_options.use_tpu_summary_optimization:\n        loop_fn = loop_fns.LoopFnWithSummaries(loop_fn)","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/orbit/standard_runner.py#L83-L119","documentation":"Error \"`use_tpu_summary_optimization=True` and `use_tf_while_loop=False` is not supported\" thrown in tensorflow/models.","triggerScenarios":"Thrown at orbit/standard_runner.py:101 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set use_tf_while_loop=True together with use_tpu_summary_optimization=True.","Disable use_tpu_summary_optimization when not using a tf.while_loop."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}