keras-team/keras · error · ValueError
Unsupported value `sparse=True`
Error message
Unsupported value `sparse=True`
What it means
Raised by keras.ops.numpy.bincount in the OpenVINO backend when sparse=True. Only dense count output is implemented for OpenVINO, so the sparse flag is a sentinel rejection.
Solutions
- Set sparse=False or omit the argument for dense output
- Post-process the dense counts if a sparse representation is needed
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at keras/src/backend/openvino/numpy.py:1161 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/7b103dbeaa1ca362.
Report an issue: GitHub.
Appendix: source
Thrown at keras/src/backend/openvino/numpy.py:1161
if isinstance(x, OpenVINOKerasTensor):
element_type = x.output.get_element_type()
if isinstance(y, OpenVINOKerasTensor):
element_type = y.output.get_element_type()
x = get_ov_output(x, element_type)
y = get_ov_output(y, element_type)
x, y = _align_operand_types(x, y, "bitwise_right_shift()")
return OpenVINOKerasTensor(ov_opset.bitwise_right_shift(x, y).output(0))
def right_shift(x, y):
return bitwise_right_shift(x, y)
def bincount(x, weights=None, minlength=0, sparse=False):
if x is None:
raise ValueError("input x is None")
if sparse:
raise ValueError("Unsupported value `sparse=True`")
x = get_ov_output(x)
x_type = x.get_element_type()
shape_x = ov_opset.shape_of(x, "i64").output(0)
rank_x = ov_opset.shape_of(shape_x, "i64").output(0)
rank_x = ov_opset.convert(rank_x, x_type).output(0)
scalar_shape = ov_opset.constant([], x_type).output(0)
rank_x = ov_opset.reshape(rank_x, scalar_shape, False).output(0)
const_minus_one = ov_opset.constant(-1, x_type).output(0)
rank_minus_one = ov_opset.add(rank_x, const_minus_one).output(0)
const_one = ov_opset.constant(1, x_type).output(0)
const_zero = ov_opset.constant(0, x_type).output(0)
minlength = get_ov_output(minlength)
minlength = ov_opset.convert(minlength, x_type).output(0)
max_element = ov_opset.reduce_max(x, const_zero, keep_dims=False).output(0)
depth = ov_opset.add(max_element, const_one).output(0)
depth = ov_opset.maximum(depth, minlength).output(0)
depth_scalar = ov_opset.reduce_max(
depth, const_zero, keep_dims=FalseView on GitHub (pinned to 7a34a03db6)