{"record":{"id":"eeff35ea854125eb","repo":"tensorflow/models","slug":"false-fn-must-be-callable","errorCode":null,"errorMessage":"`false_fn` must be callable.","messagePattern":"`false_fn` must be callable\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"official/projects/bigbird/recomputing_dropout.py","lineNumber":48,"sourceCode":"  or `false_fn()`, otherwise we use `tf.cond` to dynamically route to both.\n\n  Arguments:\n    pred: A scalar determining whether to return the result of `true_fn` or\n      `false_fn`.\n    true_fn: The callable to be performed if pred is true.\n    false_fn: The callable to be performed if pred is false.\n    name: Optional name prefix when using `tf.cond`.\n\n  Returns:\n    Tensors returned by the call to either `true_fn` or `false_fn`.\n\n  Raises:\n    TypeError: If `true_fn` or `false_fn` is not callable.\n  \"\"\"\n  if not callable(true_fn):\n    raise TypeError('`true_fn` must be callable.')\n  if not callable(false_fn):\n    raise TypeError('`false_fn` must be callable.')\n  pred_value = tf.get_static_value(pred)\n  if isinstance(pred, tf.Variable) or pred_value is None:\n    return tf.cond(\n        pred, true_fn=true_fn, false_fn=false_fn, name=name)\n  if pred_value:\n    return true_fn()\n  else:\n    return false_fn()\n\n\n# See https://www.tensorflow.org/api_docs/python/tf/keras/layers/Dropout.\nclass RecomputingDropout(tf_keras.layers.Layer):\n  \"\"\"`tf_keras.layers.Dropout` that supports `recompute_grad`.\"\"\"\n\n  def __init__(self,\n               rate,\n               noise_shape=None,\n               seed=None,","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/bigbird/recomputing_dropout.py#L30-L66","documentation":"Error \"`false_fn` must be callable.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/bigbird/recomputing_dropout.py:48 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"}