# TypeError: 无法解释层标识符：'relu6'。你的意思是 'relu' 吗？

- **ID:** `tensorflow/keras-layer-call-argument-mismatch`
- **领域:** tensorflow
- **类别:** type_error
- **错误码:** `EKLI`
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

传递给 Keras 层的字符串标识符（例如 activation='relu6'）不是可识别的激活函数名称；TensorFlow 没有内置的 'relu6' 激活函数。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 2.4 | active | — | — |
| 2.5 | active | — | — |
| 2.6 | active | — | — |
| 2.7 | active | — | — |

## 解决方案

1. ```
   Use the correct Keras activation: change 'relu6' to 'relu' if that works, or define a custom activation function: 'def relu6(x): return tf.nn.relu6(x)' and pass it as activation=relu6.
   ```
2. ```
   Import from tf.keras.activations: 'from tensorflow.keras.activations import relu6' if available, but note that relu6 is not in the public API; use tf.nn.relu6 directly in a Lambda layer.
   ```

## 无效尝试

- **Use 'relu6' as a custom activation function without registering it** — Keras only recognizes registered activations; passing an unregistered string will always raise this error. (100% 失败率)
- **Spell it as 'ReLU6' with different capitalization** — Keras activation names are case-insensitive but must match exactly; 'ReLU6' is also not a built-in activation. (90% 失败率)
