Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tensorflow 2.1.0: has no attribute 'random_normal'

I'm trying to get Uber's Ludwig to run. I get an error about there being no attribute 'random_normal'. I can reproduce the error in Python with these commands.

>>> 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]

Would appreciate help re how to get past this error.

like image 536
Sol Avatar asked Jan 28 '20 16:01

Sol


2 Answers

Tensorflow 2.0 comes with new aliases for random_normal. Using tf.random.normal instead of tf.random_normal should execute successfully.

like image 43
Lakshmikandan Avatar answered Nov 12 '22 13:11

Lakshmikandan


It was moved to tf.random.normal (along with all the other tf.random_* functions)

like image 84
GPhilo Avatar answered Nov 12 '22 12:11

GPhilo