{"record":{"id":"cc5cc5e2760294ce","repo":"tensorflow/models","slug":"window-size-must-be-positive","errorCode":null,"errorMessage":"`window_size` must be positive.","messagePattern":"`window_size` must be positive\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/triviaqa/inputs.py","lineNumber":360,"sourceCode":"  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].\n\n    Args:\n      window_size: Window size to return relative ids for. Must be positive and\n        odd since ids will be relative to the center of the window. If a Tensor,\n        must be a scalar int.\n\n    Returns:\n      <int32>[window_size] Tensor of relative position ids.\n    \"\"\"\n    if isinstance(window_size, int):\n      if window_size < 1:\n        raise ValueError('`window_size` must be positive.')\n      if window_size % 2 != 1:\n        raise ValueError('`window_size` must be odd.')\n\n    x = tf.range(self.max_distance + 1, dtype=tf.int32)\n    x = tf.pad(x, [[self.max_distance, 0]], mode='REFLECT')\n    if not self.ignore_direction:\n      direction_adder = tf.concat([\n          tf.fill([self.max_distance], self.max_distance),\n          tf.zeros([self.max_distance + 1], dtype=tf.int32)\n      ], 0)\n      x += direction_adder\n\n    len_x = x.shape.as_list()[0]\n    if len_x > window_size:\n      trim_amount = (len_x - window_size) // 2\n      return x[trim_amount:-trim_amount]\n\n    pad_amount = (window_size - len_x) // 2","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/triviaqa/inputs.py#L342-L378","documentation":"Error \"`window_size` must be positive.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/triviaqa/inputs.py:360 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"}