gpt4 book ai didi

python - 属性错误: module 'tensorflow' has no attribute 'random_shuffle'

转载 作者:行者123 更新时间:2023-12-02 01:47:10 39 4
gpt4 key购买 nike

当我尝试运行 machinelearningmastery 中的代码时,我明白

AttributeError: module 'tensorflow' has no attribute 'random_shuffle'

它指向以下内容

from mrcnn.model import MaskRCNN
from mrcnn.config import Config

model = MaskRCNN(mode='training', model_dir='./', config=config)

如何解决这个问题?

最佳答案

您可能已经安装了 Tensorflow 2.0,并且掌握机器学习的代码是在 tf < 2.0 之上编写的。

您可以执行以下两种操作之一:

  • 将 tf 降级到 v1.x
  • 将 tf.random_shuffle 更改为 tf.random.shuffle

另外,考虑将 Keras 从 v2.3.1 降级到 v2.1.1(但不是必须的)

关于python - 属性错误: module 'tensorflow' has no attribute 'random_shuffle' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59017361/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com