{"record":{"id":"f6859e48660b2e66","repo":"jax-ml/jax","slug":"only-implemented-for-order-k","errorCode":null,"errorMessage":"Only implemented for order='K'","messagePattern":"Only implemented for order='K'","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/_src/numpy/array_constructors.py","lineNumber":198,"sourceCode":"  .. _explicit sharding: https://docs.jax.dev/en/latest/parallel.html\n  \"\"\"\n  if args:\n    if len(args) > 3:\n      raise TypeError(f\"array() takes at most 5 positional arguments but {len(args) + 2} were given\")\n\n    for i, name in enumerate([\"copy\", \"order\", \"ndmin\"]):\n      if i < len(args) and [copy, order, ndmin][i] != [True, \"K\", 0][i]:\n        raise TypeError(f\"array() got multiple values for argument '{name}'\")\n    copy, order, ndmin = (list(args) + [copy, order, ndmin][len(args):])[:3]\n\n    deprecations.warn(\n        \"jax-array-positional-args\",\n        \"Passing the copy, order, and ndmin arguments to jnp.array positionally \"\n        \"is deprecated. Use keyword arguments instead.\",\n        stacklevel=2)\n\n  if order is not None and order != \"K\":\n    raise NotImplementedError(\"Only implemented for order='K'\")\n\n  # Fast path: if we're not actually doing any conversion, in many cases we\n  # can call lax.stage to lift the value into the trace.\n  if dtype is None and device is None and out_sharding is None and ndmin == 0:\n    if isinstance(object, core.Tracer) and not core.is_concrete(object):\n      return lax._array_copy(object) if copy else object\n    if isinstance(object, (int, float, complex, np.number)):\n      return lax.stage(object)\n    if isinstance(object, np.ndarray) and not isinstance(object, np.ma.MaskedArray):\n      return lax.stage(object)\n\n  # check if the given dtype is compatible with JAX\n  if dtype is not None:\n    dtype = dtypes.check_and_canonicalize_user_dtype(dtype, \"array\")\n\n  # Here we make a judgment call: we only return a weakly-typed array when the\n  # input object itself is weakly typed. That ensures asarray(x) is a no-op\n  # whenever x is weak, but avoids introducing weak types with something like","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/numpy/array_constructors.py#L180-L216","documentation":"jnp.array implements only NumPy's default memory order 'K' (K-order). NumPy's order='C'/'F' contiguity semantics have no meaning for JAX arrays, which are immutable logical views managed by XLA, so any other order string raises NotImplementedError.","triggerScenarios":"jnp.array(obj, order='C') or order='F' — any order other than None or 'K'.","commonSituations":"Reusing NumPy code that requests Fortran or C order for interoperability with BLAS routines or file I/O.","solutions":["Drop the order argument — JAX arrays don't expose memory layout","If contiguous NumPy layout is needed, convert with np.ascontiguousarray(jax_array) after transferring"],"exampleFix":"# before\na = jnp.array(x, order='F')\n# after\na = jnp.array(x)\n# if C-contiguous NumPy needed later:\nn = np.ascontiguousarray(np.asarray(a))","handlingStrategy":"validation","validationCode":"if order not in (None, 'K'):\n    order = None  # or raise early in your wrapper","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Drop order= entirely in JAX code","Do layout work in NumPy after conversion if truly needed"],"tags":["jax","not-implemented","numpy-compat","memory-order"],"backgroundTag":"unsupported-argument-value","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}