12
votes

I'm using dell laptop with GTX 960M, and i installed tensorflow 2.0 alpha. i used to use 1.5 version and it work with tf.GPUOptions, but in this version, this causes an error: AttributeError: module 'tensorflow' has no attribute 'GPUOptions' someone help me if i do the thing wrong with this version

Traceback (most recent call last): File "prepare_training.py", line 20, in gpu_option = tf.GPUOptions(per_process_gpu_memory_fraction=0.333) AttributeError: module 'tensorflow' has no attribute 'GPUOptions'

1
Changes to higher major version like these break backward compatibility. You cannot expect to upgrade without changing the original code.Croolman
sure! but i can not find any documents about the compatible function or config for GPUOption. thats my problem. thanks!An Lưu Công
Just by glancing over the documentation tf.config.gpu.set_per_process_memory_fraction(FRAC)Croolman
thank you! i just found it!An Lưu Công

1 Answers

13
votes

Tensorflow 2.x has undergone major changes from 1.x.

As per official communication,

tf.contrib will be removed from the core TensorFlow repository and build process. TensorFlow’s contrib module has grown beyond what can be maintained and supported in a single repository. Larger projects are better maintained separately, while smaller extensions will graduate to the core TensorFlow code. A special interest group (SIG) has been formed to maintain and further develop some of the more important contrib projects going forward. Please engage with this RFC if you are interested in contributing.

If you want to use the tensorflow 1.x functions/methods, there is a compatibility module kept in tensorflow 2.x.

tf.compat.v1.GPUOptions(per_process_gpu_memory_fraction)