TensorFlow version 1.0.0-rc2 on Windows OpKernel 'op BestSplits device_type CPU' for unknown op BestSplits with test code
ML System Design practice on Codemia
Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.
Introduction
The error OpKernel ('op: "BestSplits" device_type: "CPU"') for unknown op: BestSplits occurs when TensorFlow cannot find the kernel implementation for the BestSplits operation. This operation is part of TensorFlow's tensor_forest contrib module (used for random forests). The error typically appears on TensorFlow 1.x on Windows because the contrib op was not properly registered in the Windows build, or the required contrib module was not imported. The fix depends on your TensorFlow version — upgrade to TF 2.x with tensorflow-decision-forests, or explicitly import the contrib module in TF 1.x.
The Error
The BestSplits op is a custom C++ kernel in tensor_forest. On Windows builds of TF 1.0.0-rc2, this kernel was not always compiled or registered correctly.
Fix 1: Import the Contrib Module Explicitly
In TF 1.x, some contrib ops need explicit imports to register their kernels:
Importing tensor_forest_ops triggers the shared library load that registers the custom ops including BestSplits.
Fix 2: Upgrade TensorFlow
TF 1.0.0-rc2 is extremely outdated. Many Windows-specific build issues were fixed in later releases:
In TF 2.x, tf.contrib was removed entirely. Use tensorflow-decision-forests (TF-DF) instead:
Fix 3: Load the Op Library Manually
If the op is compiled but not auto-registered:
On Windows, the file extension is .pyd or .dll instead of .so.
Fix 4: Build from Source
If the pre-built binary lacks the op, build TensorFlow from source with contrib support:
Building from source ensures all contrib ops including BestSplits are compiled for your platform.
Modern Alternative: TensorFlow Decision Forests
For new projects, use TF-DF instead of the deprecated tensor_forest:
TF-DF has its own optimized C++ ops that are properly built for all platforms including Windows.
Checking Op Registration
Version Compatibility
| TF Version | tensor_forest Status | BestSplits Op | Windows Support |
| 1.0.0-rc2 | Experimental | Missing on some builds | Partial |
| 1.5-1.15 | Contrib | Available | Full |
| 2.0-2.x | Removed (tf.contrib gone) | N/A | N/A |
| TF-DF 1.x | Replacement library | Not needed | Full |
Common Pitfalls
- Using TF 1.0.0-rc2 in production: This is a release candidate, not a stable release. Upgrade to at least TF 1.15.5 for the last stable 1.x build with contrib support.
- Mixing TF versions: Installing
tensorflow-decision-forestsalongside TF 1.x causes conflicts. TF-DF requires TF 2.x. - Windows .pyd vs .so: TensorFlow op libraries use
.soon Linux/macOS and.pydon Windows. Path lookups must use the correct extension. - GPU vs CPU ops: Some custom ops are only registered for CPU. Running on GPU with
tensor_forestmay produce a different error:No OpKernel for device_type GPU. tf.contribremoval in TF 2.x: Alltf.contribmodules were removed in TensorFlow 2.0. Code usingtf.contrib.tensor_forestmust be migrated totensorflow-decision-forestsor another library.
Summary
- The
BestSplitsunknown op error is caused by an unregistered kernel in TF 1.x Windows builds - Import
tensor_forest_opsexplicitly to register the op in TF 1.x - Upgrade to TF 1.15.5 for the most stable 1.x experience on Windows
- For new projects, use
tensorflow-decision-forests(TF-DF) which replacestensor_forestentirely tf.contribwas removed in TF 2.0 — alltensor_forestcode must be migrated
Related reading
- Tensorflow visualizer Tensorboard not working under Anaconda
- Tensorflow vocabularyprocessor
- Tensorflow vs OpenCV
- tensorflow warning - Found untraced functions such as lstm_cell_6_layer_call_and_return_conditional_losses
- Tensorflow warning The graph couldn't be sorted in topological order?
- TensorFlow wasn''t compiled to use SSE etc. instructions, but these are available
- Tensorflow weight initialization
- Tensorflow What are the output_node_names for freeze_graph.py in the model_with_buckets model?
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
ML System Design practice on Codemia
Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.