首页 > 解决方案 > tensorflow_core._api.v2.random 没有属性 Generator

问题描述

当我尝试tensorflow_addons使用 tensorflow 2.1导入时看到以下错误

> import tensorflow_addons as tfa
AttributeError: module 'tensorflow_core._api.v2.random' has no attribute 'Generator'

标签: tensorflow

解决方案


您的 Tensorflow 和 Tensorflow-addons 版本之间存在不兼容性。要解决您的问题,请卸载当前版本并将其替换为您可以通过查看此表获得的正确版本

小提醒:要在终端中检查您的 Tensorflow 版本类型:

python -c 'import tensorflow as tf; print(tf.__version__)'

推荐阅读