tensorflow:AttributeError: 'module' object has no attribute 'mul'

Solution 1:

According to the tensorflow 1.0.0 release notes,

tf.mul, tf.sub and tf.neg are deprecated in favor of tf.multiply, tf.subtract and tf.negative.

You'll need to replace tf.mul with tf.multiply.

Solution 2:

This operation was previously available in 0.x versions. With the release of TF 1.0 they introduced breaking changes to the API. In addition to

tf.mul, tf.sub and tf.neg are deprecated in favor of tf.multiply, tf.subtract and tf.negative

many other functions were renamed and changed with the following justification:

Several python API calls have been changed to resemble NumPy more closely.

So a lot of the scripts that you already found on the web or from the books will not work. Good thing is that majority of them can be fixed with their migration script. It can be run with tf_upgrade.py --infile foo.py --outfile foo-upgraded.py. It will not be able to solve everything (limitations are listed here), but will save you a lot of work.