keras-team/keras · error · ValueError

The `flip` operation does not support tensors with dynamic…

Error message

The `flip` operation does not support tensors with dynamic rank for the OpenVINO backend.

What it means

Raised by keras.ops.numpy.flip in the OpenVINO backend when the input tensor's rank is dynamic (None). Building the reversal axes/strided-slice needs a statically known rank at graph construction time, so dynamic-rank tensors are rejected.

Solutions

  1. Provide a tensor with static rank (rebuild the graph avoiding dynamic ranks)
  2. Use flipud/fliplr which fix the axis explicitly
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at keras/src/backend/openvino/numpy.py:1970 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/6b6553d9e4fea06d. Report an issue: GitHub.

Appendix: source

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

def expm1(x):
    x = get_ov_output(x)
    x_type = x.get_element_type()
    if x_type.is_integral():
        ov_type = OPENVINO_DTYPES[config.floatx()]
        x = ov_opset.convert(x, ov_type)
    exp_x = ov_opset.exp(x).output(0)
    const_one = ov_opset.constant(1, exp_x.get_element_type())
    result = ov_opset.subtract(exp_x, const_one).output(0)
    return OpenVINOKerasTensor(result)


def flip(x, axis=None):
    x_node = get_ov_output(x)

    # Using OpenVINO tensor shape
    ndim = len(x_node.get_partial_shape())
    if ndim is None:
        raise ValueError(
            "The `flip` operation does not support tensors with dynamic rank "
            "for the OpenVINO backend."
        )

    if axis is None:
        axis = list(range(ndim))
    elif isinstance(axis, int):
        axis = [axis]

    axis = [a + ndim if a < 0 else a for a in axis]

    begin = [0] * ndim
    end = [0] * ndim
    strides = [1] * ndim
    for a in axis:
        strides[a] = -1

    all_ones_mask = [1] * ndim

View on GitHub (pinned to 7a34a03db6)