{"record":{"id":"4684ee7abfef6b40","repo":"tensorflow/models","slug":"the-lengths-of-strides-and-axes-need-to-match","errorCode":null,"errorMessage":"The lengths of strides and axes need to match.","messagePattern":"The lengths of strides and axes need to match\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/modeling/networks/funnel_transformer.py","lineNumber":78,"sourceCode":"  It also skips first unpool_length elements.\n\n  Args:\n    mask: Tensor to be pooled.\n    unpool_length: Leading elements to be skipped.\n    strides: Strides for the given axes.\n    axes: Axes to pool the Tensor.\n\n  Returns:\n    Pooled and concatenated Tensor.\n  \"\"\"\n  # Wraps the axes as a list.\n  if isinstance(axes, int):\n    axes = [axes]\n  if isinstance(strides, int):\n    strides = [strides] * len(axes)\n  else:\n    if len(strides) != len(axes):\n      raise ValueError('The lengths of strides and axes need to match.')\n  # Bypass no pooling cases.\n  if np.all(np.array(strides) == 1):\n    return mask\n\n  for axis, stride in zip(axes, strides):\n    # Skips first `unpool_length` tokens.\n    unpool_tensor_shape = [slice(None)] * axis + [slice(None, unpool_length)]\n    unpool_tensor = mask[unpool_tensor_shape]\n    # Pools the second half.\n    pool_tensor_shape = [slice(None)] * axis + [\n        slice(unpool_length, None, stride)\n    ]\n    pool_tensor = mask[pool_tensor_shape]\n    mask = tf.concat((unpool_tensor, pool_tensor), axis=axis)\n  return mask\n\n\ndef _create_fractional_pool_transform(sl: int, pool_factor: float):","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/modeling/networks/funnel_transformer.py#L60-L96","documentation":"Error \"The lengths of strides and axes need to match.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/modeling/networks/funnel_transformer.py:78 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"}