{"record":{"id":"0e82061b6480dca1","repo":"keras-team/keras","slug":"invalid-ord-argument-for-vector-norm-received","errorCode":null,"errorMessage":"Invalid `ord` argument for vector norm. Received: ord={ord}","messagePattern":"Invalid `ord` argument for vector norm\\. Received: ord=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/tensorflow/linalg.py","lineNumber":96,"sourceCode":"            return tf.sqrt(\n                tf.reduce_sum(x * tf.math.conj(x), axis=axis, keepdims=keepdims)\n            )\n        elif ord == float(\"inf\"):\n            return tf.math.reduce_max(\n                tf.math.abs(x), axis=axis, keepdims=keepdims\n            )\n        elif ord == float(\"-inf\"):\n            return tf.math.reduce_min(\n                tf.math.abs(x), axis=axis, keepdims=keepdims\n            )\n        elif ord == 0:\n            return tf.math.reduce_sum(\n                tf.cast(tf.not_equal(x, 0), dtype=x.dtype),\n                axis=axis,\n                keepdims=keepdims,\n            )\n        elif isinstance(ord, str):\n            raise ValueError(\n                f\"Invalid `ord` argument for vector norm. Received: ord={ord}\"\n            )\n        else:\n            ord = convert_to_tensor(ord, dtype=x.dtype)\n            out = tf.math.reduce_sum(\n                tf.pow(tf.math.abs(x), ord), axis=axis, keepdims=keepdims\n            )\n            return tf.pow(out, 1.0 / ord)\n    elif num_axes == 2:\n        row_axis, col_axis = axis[0], axis[1]\n        row_axis = row_axis + ndim if row_axis < 0 else row_axis\n        col_axis = col_axis + ndim if col_axis < 0 else col_axis\n        if ord is None or ord == \"fro\":\n            return tf.sqrt(\n                tf.reduce_sum(x * tf.math.conj(x), axis=axis, keepdims=keepdims)\n            )\n        elif ord == 1:\n            if not keepdims and col_axis > row_axis:","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/tensorflow/linalg.py#L78-L114","documentation":"Raised by the vector-norm branch of keras/src/backend/tensorflow/linalg.py norm: when the norm is computed over a 1-D slice, only specific ord values are implemented (None, 0, 1, -1, 2, -2, inf, -inf). The received ord matches none of them (e.g. a fractional or arbitrary positive integer), so the dispatch chain falls through to this error.","triggerScenarios":"Thrown at keras/src/backend/tensorflow/linalg.py:96 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a supported vector ord: None, 0, 1, -1, 2, -2, float('inf'), or float('-inf')","For a custom exponent p, compute (sum(abs(x)**p))**(1/p) manually if p is not supported","Pass ord=None for the standard L2 norm"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}