{"record":{"id":"79d505dae87ccf65","repo":"jax-ml/jax","slug":"reduce-window-got-inconsistent-window-strides-and","errorCode":null,"errorMessage":"reduce_window got inconsistent window_strides and window_dimensions: got window_strides {} and window_dimensions {}.","messagePattern":"reduce_window got inconsistent window_strides and window_dimensions: got window_strides (.+?) and window_dimensions (.+?)\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"jax/_src/lax/windowed_reductions.py","lineNumber":613,"sourceCode":"    base_dilation,\n    window_dilation,\n):\n  lax._check_shapelike(\"reduce_window\", \"window_dimensions\", window_dimensions,\n                       non_zero_shape=True)\n  lax._check_shapelike(\"reduce_window\", \"window_strides\", window_strides,\n                       non_zero_shape=True)\n  lax._check_shapelike(\"reduce_window\", \"base_dilation\", base_dilation)\n  lax._check_shapelike(\"reduce_window\", \"window_dilation\", window_dilation)\n  if operand.ndim != len(window_dimensions):\n    msg = (\n        \"reduce_window got the wrong number of window_dimensions for \"\n        \"operand: got operand shape {} with window_dimensions {}.\"\n    )\n    raise TypeError(msg.format(operand.shape, window_dimensions))\n  if len(window_strides) != len(window_dimensions):\n    msg = (\"reduce_window got inconsistent window_strides and \"\n           \"window_dimensions: got window_strides {} and window_dimensions {}.\")\n    raise TypeError(msg.format(window_strides, window_dimensions))\n  if len(base_dilation) != len(window_dimensions):\n    msg = (\"reduce_window got inconsistent base_dilation and \"\n           \"window_dimensions: got base_dilation {} and window_dimensions {}.\")\n    raise TypeError(msg.format(base_dilation, window_dimensions))\n  if len(window_dilation) != len(window_dimensions):\n    msg = (\"reduce_window got inconsistent window_dilation and \"\n           \"window_dimensions: got window_dilation {} and window_dimensions \"\n           \"{}.\")\n    raise TypeError(msg.format(window_dilation, window_dimensions))\n\n  return reduce_window_shape_tuple(operand.shape, window_dimensions,\n                                   window_strides, padding, base_dilation,\n                                   window_dilation)\n\ndef reduce_window_shape_tuple(operand_shape, window_dimensions, window_strides,\n                              padding, base_dilation=None,\n                              window_dilation=None):\n  if base_dilation is not None:","sourceCodeStart":595,"sourceCodeEnd":631,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/lax/windowed_reductions.py#L595-L631","documentation":"All windowing parameters of lax.reduce_window must have the same length as window_dimensions. This fires when len(window_strides) != len(window_dimensions).","triggerScenarios":"Passing window_strides=(1,1) with window_dimensions=(1,3,3,1) (mismatched lengths).","commonSituations":"Building pooling layers where strides list was updated but window dims weren't (or vice versa).","solutions":["Make window_strides the same length as window_dimensions, padding to 1 for non-spatial axes"],"exampleFix":"# before\nlax.reduce_window(x, init, jaxpr, (1,3,3,1), (2,2), padding)\n# after\nlax.reduce_window(x, init, jaxpr, (1,3,3,1), (1,2,2,1), padding)","handlingStrategy":"validation","validationCode":"assert len(window_strides) == len(window_dimensions)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build all window params from one spatial tuple, e.g. full=lambda s: (1, *s, 1)"],"tags":["jax","shape-validation","reduce-window","strides"],"backgroundTag":"jax-reduce-window-invalid-arguments","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}