{"record":{"id":"a0734f6a623937f2","repo":"tensorflow/models","slug":"batch-size-must-be-positive","errorCode":null,"errorMessage":"`batch_size` must be positive.","messagePattern":"`batch_size` must be positive\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/triviaqa/inputs.py","lineNumber":271,"sourceCode":"          [6, 6, 6, 5, 4, 0],\n      ]]\n\n    Args:\n      seq_len: The sequence length to create ids for. Must be positive. If a\n        Tensor, must be a scalar int.\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, seq_len] Tensor of relative position ids.\n    \"\"\"\n    with tf.name_scope(name or 'make_relative_att_ids'):\n      if isinstance(seq_len, int) and seq_len < 1:\n        raise ValueError('`seq_len` must be positive.')\n      if isinstance(batch_size, int) and batch_size < 1:\n        raise ValueError('`batch_size` must be positive.')\n\n      # We need the id_pattern to cover all tokens to the left of the last token\n      # and all tokens to the right of the first token at the same time.\n      window_size = 2 * seq_len - 1\n\n      # [window_size]\n      id_pattern = self._make_relative_id_pattern(window_size)\n\n      # [seq_len, window_size]\n      id_tensor = tf.tile(id_pattern[tf.newaxis, :], [seq_len, 1])\n\n      # [seq_len, window_size + seq_len - 1]\n      id_tensor = _skew_elements_right(id_tensor, -1)\n\n      # [seq_len, seq_len]\n      id_tensor = tf.slice(id_tensor, [0, seq_len - 1], [seq_len, seq_len])\n\n      return tf.tile(id_tensor[tf.newaxis, :, :], [batch_size, 1, 1])","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/triviaqa/inputs.py#L253-L289","documentation":"Error \"`batch_size` must be positive.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/triviaqa/inputs.py:271 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"}