出现在代码中的setup_seed(seed)代码的问题
AttributeError: module 'tensorflow.keras.utils' has no attribute 'set_random_seed'
解决方法:
这个错误提示显示在 `moabb` 的 `utils.py` 文件中的 `setup_seed` 函数中出现了问题。错误提示中的 `AttributeError` 表示 `tensorflow.keras.utils` 模块中没有 `set_random_seed` 方法。
这个错误可能是由于你的 TensorFlow 版本不同导致的。在 TensorFlow 2.0 中,`set_random_seed` 方法已经被弃用,应该使用 `tf.random.set_seed` 方法来设置随机种子。
1. 如果你正在使用 TensorFlow 2.0 或更高版本,你可以尝试修改 `moabb` 的源代码,将 `set_random_seed` 方法替换为 `tf.random.set_seed` 方法。你可以在 `utils.py` 文件中找到以下代码:
```
tf.keras.utils.set_random_seed(seed)
```
将这行代码修改为:
```
tf.random.set_seed(seed)
```
然后重新运行你的代码。
源代码路径可以看终端报错的内容中查找到。