tensorflow 2.1.0:没有属性 'random_normal'

tensorflow 2.1.0: has no attribute 'random_normal'

我正在尝试让 Uber 的路德维希 运行。我收到有关没有属性 'random_normal' 的错误消息。我可以使用这些命令重现 Python 中的错误。

>>> import tensorflow as tf
>>> tf.reduce_sum(tf.random_normal([1000,1000]))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute 'random_normal'
>>> print(tf.__version__)
2.1.0
>>> print(sys.version)
3.7.5 (defaut, Oct 25 2019, 15:51:11)
[GCC 7.3.0]

将不胜感激关于如何解决此错误的帮助。

它已移至 tf.random.normal(连同所有其他 tf.random_* 函数)

Tensorflow 2.0 为 random_normal 带来了新的 aliases。使用 tf.random.normal 而不是 tf.random_normal 应该会成功执行。