Reputation: 10011
While setting an environment for tensorflow models, when I run python model_builder_test.py
at last step, causes AttributeError: module 'tensorflow' has no attribute 'float32'
, does someone know how to fix it? Thanks.
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md
PS C:\Users\User\models\research\object_detection\builders> python model_builder_test.py
Traceback (most recent call last):
File "model_builder_test.py", line 21, in <module>
from object_detection.builders import model_builder
File "C:\Users\User\models\research\object_detection\builders\model_builder.py", line 17, in <module>
from object_detection.builders import anchor_generator_builder
File "C:\Users\User\models\research\object_detection\builders\anchor_generator_builder.py", line 18, in <module>
from object_detection.anchor_generators import grid_anchor_generator
File "C:\Users\User\models\research\object_detection\anchor_generators\grid_anchor_generator.py", line 27, in <module>
from object_detection.utils import ops
File "C:\Users\User\models\research\object_detection\utils\ops.py", line 282, in <module>
dtype=tf.float32):
AttributeError: module 'tensorflow' has no attribute 'float32'
Upvotes: 3
Views: 17031
Reputation: 139
I fixed the problem with the command: pip install --upgrade --force-reinstall tensorflow
Upvotes: 0
Reputation: 4992
tensorflow has float32.
In [1]: import tensorflow as tf
In [2]: tf.float32
Out[2]: tf.float32
Above is my output confirming that. This is a known problem while installing in windows.You can take a look Here.
To fix it, you just need to reinstall tensorflow
using the following commang
pip install --upgrade --force-reinstall tensorflow
Note:One More common mistake is naming a module as tensorflow
. this might make it to import this module you created which is empty
Upvotes: 6