keras-team/keras · error · NotImplementedError
Could not extract num value from tensor
Error message
Could not extract num value from tensor
What it means
Raised by the OpenVINO backend linspace when the num argument is a graph tensor whose value could not be extracted (not a Constant node, or reading the constant failed). The number of samples must be known at graph-build time, so dynamic num values raise this catch-all NotImplementedError.
Solutions
- Pass num as a Python int instead of a tensor
- If num comes from computation, evaluate it to a concrete integer before calling linspace
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at keras/src/backend/openvino/numpy.py:2675 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/74c174e3030b96e6.
Report an issue: GitHub.
Appendix: source
Thrown at keras/src/backend/openvino/numpy.py:2675
If `retstep` is True, also returns the step size between values.
"""
start = get_ov_output(start)
stop = get_ov_output(stop)
if hasattr(num, "output") or isinstance(num, OpenVINOKerasTensor):
num_tensor = get_ov_output(num)
try:
if num_tensor.get_node().get_type_name() == "Constant":
num_value = num_tensor.get_node().get_vector()[0]
num = int(num_value)
else:
raise NotImplementedError(
"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)View on GitHub (pinned to 7a34a03db6)