{"record":{"id":"2535e75339d6b683","repo":"tensorflow/models","slug":"value-has-unknown-batch","errorCode":null,"errorMessage":"{value} has unknown batch.","messagePattern":"(.+?) has unknown batch\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"official/modeling/tf_utils.py","lineNumber":284,"sourceCode":"      be concatenated.\n    axis: The axis along which to perform the concatenation as a Python integer\n      (not a `Tensor`). E.g., `axis=0` to concatenate along the batch dimension.\n    name: A name for the operation (used to create a name scope).\n\n  Returns:\n    The result of concatenating `value` along `axis` across replicas.\n\n  Raises:\n    RuntimeError: when the batch (0-th) dimension is None.\n  \"\"\"\n  with tf.name_scope(name):\n    context = tf.distribute.get_replica_context()\n    # Typically this could be hit only if the tensor is derived from a\n    # dataset with finite epochs and drop_remainder=False, where the last\n    # batch could of different batch size and then the dim-0 is of dynamic\n    # shape.\n    if value.shape.as_list()[0] is None:\n      raise RuntimeError(f\"{value} has unknown batch.\")\n    return context.all_gather(value, axis=axis)\n\n\ndef clone_initializer(initializer):\n  # Keras initializer is going to be stateless, which mean reusing the same\n  # initializer will produce same init value when the shapes are the same.\n  if isinstance(initializer, tf_keras.initializers.Initializer):\n    return initializer.__class__.from_config(initializer.get_config())\n  # When the input is string/dict or other serialized configs, caller will\n  # create a new keras Initializer instance based on that, and we don't need to\n  # do anything\n  return initializer\n\n\ndef serialize_keras_object(obj):\n  if hasattr(tf_keras.utils, \"legacy\"):\n    return tf_keras.utils.legacy.serialize_keras_object(obj)\n  else:","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/modeling/tf_utils.py#L266-L302","documentation":"Error \"{value} has unknown batch.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/modeling/tf_utils.py:284 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"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"}