{"record":{"id":"b555d8c7b8cd1b3c","repo":"jax-ml/jax","slug":"np-reshape-order-a-is-not-implemented","errorCode":null,"errorMessage":"np.reshape order=A is not implemented.","messagePattern":"np\\.reshape order=A is not implemented\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/_src/numpy/array_methods.py","lineNumber":386,"sourceCode":"def _reshape(self: Array, *args: Any, order: str = \"C\", out_sharding=None\n             ) -> Array:\n  \"\"\"Returns an array containing the same data with a new shape.\n\n  Refer to :func:`jax.numpy.reshape` for full documentation.\n  \"\"\"\n  __tracebackhide__ = True\n  newshape = _compute_newshape(self, args[0] if len(args) == 1 else args)\n  if order == \"C\":\n    return lax.reshape(self, newshape, None, out_sharding=out_sharding)\n  elif order == \"F\":\n    dims = list(range(self.ndim)[::-1])\n    out_sharding = canonicalize_sharding(out_sharding, \"jnp.reshape\")\n    out_sharding = (\n        None if out_sharding is None else out_sharding.update(\n            spec=out_sharding.spec.update(partitions=out_sharding.spec[::-1])))\n    return lax.reshape(self, newshape[::-1], dims, out_sharding=out_sharding).T\n  elif order == \"A\":\n    raise NotImplementedError(\"np.reshape order=A is not implemented.\")\n  else:\n    raise ValueError(f\"Unexpected value for 'order' argument: {order}.\")\n\ndef _round(self: Array, decimals: int = 0, out: None = None) -> Array:\n  \"\"\"Round array elements to a given decimal.\n\n  Refer to :func:`jax.numpy.round` for full documentation.\n  \"\"\"\n  return lax_numpy.round(self, decimals=decimals, out=out)\n\ndef _searchsorted(self: Array, v: ArrayLike, side: str = 'left',\n                  sorter: ArrayLike | None = None, *, method: str = 'scan') -> Array:\n  \"\"\"Perform a binary search within a sorted array.\n\n  Refer to :func:`jax.numpy.searchsorted` for full documentation.\"\"\"\n  return lax_numpy.searchsorted(self, v, side=side, sorter=sorter, method=method)\n\ndef _sort(self: Array, axis: int | None = -1, *, kind: None = None,","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/numpy/array_methods.py#L368-L404","documentation":"`jax.numpy.reshape` (and `Array.reshape`) supports order='C' and order='F' but not order='A' (Fortran-contiguous-if-input-is-F-else-C), because JAX arrays have no contiguity concept. NumPy accepts 'A'; JAX raises NotImplementedError.","triggerScenarios":"Calling `arr.reshape(shape, order='A')` or `jnp.reshape(arr, shape, order='A')`.","commonSituations":"Porting NumPy code that passes order='A'; generic library code where order is a parameter that can be 'A'.","solutions":["Drop the order argument (default 'C' matches JAX semantics)","Use order='F' if Fortran order was intended","Branch on order != 'A' before calling reshape in shared NumPy/JAX code"],"exampleFix":"# before\njnp.reshape(a, (2, 3), order='A')\n\n# after\njnp.reshape(a, (2, 3))  # or order='F' if that was meant","handlingStrategy":"validation","validationCode":"def reshape_compat(a, shape, order='C'):\n    if order == 'A':\n        order = 'C'\n    return a.reshape(shape, order=order)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never propagate order='A' into JAX","Strip/normalize the order kwarg in NumPy/JAX-agnostic wrappers"],"tags":["jax","reshape","not-implemented","numpy-compat"],"backgroundTag":"unsupported-argument-value","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}