{"record":{"id":"adfce21e84db0d59","repo":"tensorflow/models","slug":"local-radius-must-be-positive","errorCode":null,"errorMessage":"`local_radius` must be positive.","messagePattern":"`local_radius` must be positive\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/triviaqa/inputs.py","lineNumber":330,"sourceCode":"    Args:\n      seq_len: The sequence length to create ids for. Must be positive. If a\n        Tensor, must be a scalar int.\n      local_radius: The local radius as expected by\n        `layers.RelativeLocalSelfAttention`. Must be positive.\n      batch_size: The batch size of the result (default 1). Must be positive. If\n        a Tensor, must be a scalar int. All examples in the batch will have the\n        same id pattern.\n      name: A name for the operation (optional).\n\n    Returns:\n      <int32>[batch_size, seq_len, 2*local_radius + 1] Tensor of relative\n      position ids.\n    \"\"\"\n    with tf.name_scope(name or 'make_local_relative_att_ids'):\n      if isinstance(seq_len, int) and seq_len < 1:\n        raise ValueError('`seq_len` must be positive.')\n      if local_radius < 1:\n        raise ValueError('`local_radius` must be positive.')\n      if isinstance(batch_size, int) and batch_size < 1:\n        raise ValueError('`batch_size` must be positive.')\n\n      window_size = 2 * local_radius + 1\n\n      # [window_size]\n      id_pattern = self._make_relative_id_pattern(window_size)\n\n      return tf.tile(id_pattern[tf.newaxis, tf.newaxis, :],\n                     [batch_size, seq_len, 1])\n\n  def _make_relative_id_pattern(\n      self, window_size: Union[int, tf.Tensor]) -> tf.Tensor:\n    \"\"\"Helper for making the relative id pattern for a particular window size.\n\n    For example, if `max_distance` is 3, `ignore_direction` is False, and\n    `window_size` is 11, the result is the following:\n    [6, 6, 6, 5, 4, 0, 1, 2, 3, 3, 3].","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/triviaqa/inputs.py#L312-L348","documentation":"Error \"`local_radius` must be positive.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/triviaqa/inputs.py:330 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"}