keras-team/keras · error · NotImplementedError

`view` from {old_dtype} to {new_dtype} is not supported for

Error message

`view` from {old_dtype} to {new_dtype} is not supported for non-constant tensors with the OpenVINO backend (no bitcast operation available in OpenVINO opset).

What it means

Error "`view` from {old_dtype} to {new_dtype} is not supported for non-constant tensors with the OpenVINO backend (no bitcast operation available in OpenVINO opset)." thrown in keras-team/keras.

Source

Thrown at keras/src/backend/openvino/numpy.py:698

            ov_model = ov.Model(results=[x_ov], parameters=[])
            compiled = ov.compile_model(ov_model, "CPU")
            np_data = compiled({})[0]
        old_shape = np_data.shape
        new_last = old_shape[-1] * old_itemsize // new_itemsize
        new_shape = list(old_shape[:-1]) + [new_last]
        raw = np.frombuffer(np_data.tobytes(), dtype=np.uint8)
        result_tensor = ov.Tensor(new_ov_type, new_shape)
        np.copyto(
            np.frombuffer(result_tensor.data, dtype=np.uint8),
            raw,
        )
        return OpenVINOKerasTensor(ov_opset.constant(result_tensor).output(0))
    except Exception:
        pass

    # Non-constant tensors: only integer↔integer is supported
    if not (old_ov_type.is_integral() and new_ov_type.is_integral()):
        raise NotImplementedError(
            f"`view` from {old_dtype} to {new_dtype} is not supported "
            "for non-constant tensors with the OpenVINO backend "
            "(no bitcast operation available in OpenVINO opset)."
        )

    if old_itemsize == new_itemsize:
        # Same-width signed↔unsigned: convert preserves bit pattern
        return OpenVINOKerasTensor(
            ov_opset.convert(x_ov, new_ov_type).output(0)
        )
    elif old_itemsize > new_itemsize:
        return _view_int_expand(x_ov, new_ov_type, old_itemsize, new_itemsize)
    else:
        return _view_int_contract(x_ov, new_ov_type, old_itemsize, new_itemsize)


def _split_shape_leading_last(x):
    """Return (leading_dims, last_dim) from the shape of *x*.

View on GitHub (pinned to 7a34a03db6)

When it happens

Trigger: Thrown at keras/src/backend/openvino/numpy.py:698 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of keras-team/keras@7a34a03db6 (2026-08-25). Data as JSON: /api/errors/e6d73a3ce5c201d4. Report an issue: GitHub.