{"record":{"id":"4d6492d44f513996","repo":"jax-ml/jax","slug":"ragged-all-to-all-send-sizes-must-be-integer-type","errorCode":null,"errorMessage":"ragged_all_to_all send_sizes must be integer type.","messagePattern":"ragged_all_to_all send_sizes must be integer type\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/lax/parallel.py","lineNumber":1647,"sourceCode":"\n  return hlo.CustomCallOp(\n      result=[output.type],\n      inputs=[operand, output, input_offsets, send_sizes, output_offsets,\n              recv_sizes],\n      call_target_name=ir.StringAttr.get('ragged_all_to_all'),\n      backend_config=ir.DictAttr.get(ragged_all_to_all_attrs),\n      api_version=ir.IntegerAttr.get(ir.IntegerType.get_signless(32), 4),\n  ).results\n\ndef _ragged_all_to_all_effectful_abstract_eval(\n    operand, output, input_offsets, send_sizes, output_offsets, recv_sizes,\n    axis_name, axis_index_groups\n):\n  del operand, axis_index_groups\n  if not dtypes.issubdtype(input_offsets.dtype, np.integer):\n    raise ValueError(\"ragged_all_to_all input_offsets must be integer type.\")\n  if not dtypes.issubdtype(send_sizes.dtype, np.integer):\n    raise ValueError(\"ragged_all_to_all send_sizes must be integer type.\")\n  if not dtypes.issubdtype(output_offsets.dtype, np.integer):\n    raise ValueError(\"ragged_all_to_all output_offsets must be integer type.\")\n  if not dtypes.issubdtype(recv_sizes.dtype, np.integer):\n    raise ValueError(\"ragged_all_to_all recv_sizes must be integer type.\")\n  if len(input_offsets.shape) != 1 or input_offsets.shape[0] < 1:\n    raise ValueError(\n        \"ragged_all_to_all input_offsets must be rank 1 with positive dimension\"\n        \" size, but got shape {}\".format(input_offsets.shape)\n    )\n  if len(send_sizes.shape) != 1 or send_sizes.shape[0] < 1:\n    raise ValueError(\n        \"ragged_all_to_all send_sizes must be rank 1 with positive dimension\"\n        \" size, but got shape {}\".format(send_sizes.shape)\n    )\n  if len(output_offsets.shape) != 1 or output_offsets.shape[0] < 1:\n    raise ValueError(\n        \"ragged_all_to_all output_offsets must be rank 1 with positive\"\n        \" dimension size, but got shape {}\".format(output_offsets.shape)","sourceCodeStart":1629,"sourceCodeEnd":1665,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/lax/parallel.py#L1629-L1665","documentation":"send_sizes for ragged_all_to_all must have an integer dtype; the abstract eval checks dtypes.issubdtype(send_sizes.dtype, np.integer) and raises ValueError otherwise.","triggerScenarios":"Passing float send_sizes to lax.ragged_all_to_all.","commonSituations":"Deriving sizes from shape arithmetic in float; default numpy float arrays from literals like np.array([4, 8]) is fine but np.array([4., 8.]) is not.","solutions":["Cast send_sizes to np.int64/int32","Use integer literals when constructing the array","Add a dtype assertion helper for all four offset/size arrays"],"exampleFix":"// before\nlax.ragged_all_to_all(x, out, offs, np.array([4.0, 8.0]), 'i')\n// after\nlax.ragged_all_to_all(x, out, offs, np.array([4, 8], dtype=np.int32), 'i')","handlingStrategy":"validation","validationCode":"assert np.issubdtype(np.asarray(send_sizes).dtype, np.integer), 'send_sizes must be int'","typeGuard":"def is_int_array(a): return np.issubdtype(np.asarray(a).dtype, np.integer)","tryCatchPattern":null,"preventionTips":["Use np.array(..., dtype=np.int64) literals for sizes"],"tags":["jax","ragged-all-to-all","dtype"],"backgroundTag":"dtype-mismatch","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}