# 内部错误：OpKernel 注册失败：在已注册的操作列表中找不到 'CustomOp'。

- **ID:** `tensorflow/custom-op-not-found`
- **领域:** tensorflow
- **类别:** build_error
- **错误码:** `E006`
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

自定义 TensorFlow 操作未能正确编译或加载，导致运行时找不到其内核。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| tensorflow>=2.0.0 | active | — | — |
| tensorflow<=2.13.0 | active | — | — |

## 解决方案

1. ```
   Compile the custom op using tf.load_op_library('path/to/custom_op.so') and ensure the .so file is in the same directory as the script.
   ```
2. ```
   Use tf.raw_ops.CustomOp after ensuring the op is registered via a proper build script (e.g., using Bazel or CMake). Example: from tensorflow.python.framework import load_library; custom_op = load_library.load_op_library('custom_op.so')
   ```

## 无效尝试

- **Use pip install tensorflow-custom-op** — Assumes a pip package exists; usually custom ops are not distributed via pip. (90% 失败率)
- **Set PYTHONPATH to include the op source directory** — Does not compile the op; only adds source to path. (95% 失败率)
