tensorflow/models · error · ValueError
Unrecognized constructor
Error message
Unrecognized constructor: {} What it means
Raised in get_constructor when the data-constructor name is neither 'bisection' nor 'materialized'; only these two NCF negative-sampling constructors exist.
Solutions
- Use constructor type 'bisection' or 'materialized' in your config
- Check spelling of the constructor name string
- Register/extend get_constructor with a new branch if you added a custom DataConstructor subclass
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/recommendation/data_pipeline.py:982 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/7f878922e023f6ea.
Report an issue: GitHub.
Appendix: source
Thrown at official/recommendation/data_pipeline.py:982
# negative item choice index.
assert np.all((right_index - left_index) <= 1)
output[not_use_shortcut] = (
self._sorted_train_pos_items[right_index] -
(self._total_negatives[right_index] - neg_item_choice))
assert np.all(output >= 0)
return output
def get_constructor(name):
if name == "bisection":
return BisectionDataConstructor
if name == "materialized":
return MaterializedDataConstructor
raise ValueError("Unrecognized constructor: {}".format(name))
View on GitHub (pinned to e006f5f0d5)