{"record":{"id":"d4cbaff7c7dce19f","repo":"tensorflow/models","slug":"when-used-with-mirrored-valid-values-for-all-re","errorCode":null,"errorMessage":"When used with `mirrored`, valid values for all_reduce_alg are [`nccl`, `hierarchical_copy`].  Supplied value: {}","messagePattern":"When used with `mirrored`, valid values for all_reduce_alg are \\[`nccl`, `hierarchical_copy`\\]\\.  Supplied value: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/common/distribute_utils.py","lineNumber":68,"sourceCode":"\n  Args:\n    all_reduce_alg: a string specifying which cross device op to pick, or None.\n    num_packs: an integer specifying number of packs for the cross device op.\n\n  Returns:\n    tf.distribute.CrossDeviceOps object or None.\n\n  Raises:\n    ValueError: if `all_reduce_alg` not in [None, \"nccl\", \"hierarchical_copy\"].\n  \"\"\"\n  if all_reduce_alg is None:\n    return None\n  mirrored_all_reduce_options = {\n      \"nccl\": tf.distribute.NcclAllReduce,\n      \"hierarchical_copy\": tf.distribute.HierarchicalCopyAllReduce\n  }\n  if all_reduce_alg not in mirrored_all_reduce_options:\n    raise ValueError(\n        \"When used with `mirrored`, valid values for all_reduce_alg are \"\n        \"[`nccl`, `hierarchical_copy`].  Supplied value: {}\".format(\n            all_reduce_alg))\n  cross_device_ops_class = mirrored_all_reduce_options[all_reduce_alg]\n  return cross_device_ops_class(num_packs=num_packs)\n\n\ndef tpu_initialize(tpu_address):\n  \"\"\"Initializes TPU for TF 2.x training.\n\n  Args:\n    tpu_address: string, bns address of master TPU worker.\n\n  Returns:\n    A TPUClusterResolver.\n  \"\"\"\n  cluster_resolver = tf.distribute.cluster_resolver.TPUClusterResolver(\n      tpu=tpu_address)","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/common/distribute_utils.py#L50-L86","documentation":"Error \"When used with `mirrored`, valid values for all_reduce_alg are [`nccl`, `hierarchical_copy`].  Supplied value: {}\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/common/distribute_utils.py:68 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"}