keras-team/keras · error · ValueError
Number of samples, `num`, must be non-negative.
Error message
Number of samples, `num`, must be non-negative.
What it means
Error "Number of samples, `num`, must be non-negative." thrown in keras-team/keras.
Source
Thrown at keras/src/backend/openvino/numpy.py:2690
"Dynamic num values not fully supported"
)
except Exception as e:
raise NotImplementedError(
"Could not extract num value from tensor"
) from e
else:
num = int(num)
if dtype is None:
output_type = OPENVINO_DTYPES[config.floatx()]
else:
output_type = OPENVINO_DTYPES[dtype]
start = ov_opset.convert(start, output_type).output(0)
stop = ov_opset.convert(stop, output_type).output(0)
if num < 0:
raise ValueError("Number of samples, `num`, must be non-negative.")
if num == 0:
empty_shape = ov_opset.constant([0], Type.i32).output(0)
result = ov_opset.broadcast(
ov_opset.constant(0.0, output_type).output(0), empty_shape
).output(0)
if retstep:
nan_step = ov_opset.constant(np.nan, output_type).output(0)
return OpenVINOKerasTensor(result), OpenVINOKerasTensor(nan_step)
return OpenVINOKerasTensor(result)
if num == 1:
result_val = start
axis_const = ov_opset.constant([axis], Type.i32).output(0)
result = ov_opset.unsqueeze(result_val, axis_const).output(0)
if retstep:
if endpoint:
step = ov_opset.constant(np.nan, output_type).output(0)View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/backend/openvino/numpy.py:2690 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/e56b6d5ce932a0b2.
Report an issue: GitHub.