Reputation: 11
~\AppData\Roaming\Python\Python36\site-packages\tensorflow\contrib\tpu\python\tpu\tpu_estimator.py in <module>()
38 from tensorflow.contrib.tpu.python.tpu import tpu_config
39 from tensorflow.contrib.tpu.python.tpu import tpu_context
---> 40 from tensorflow.contrib.tpu.python.tpu import tpu_feed
41 from tensorflow.contrib.tpu.python.tpu import training_loop
42 from tensorflow.contrib.tpu.python.tpu import util as util_lib
~\AppData\Roaming\Python\Python36\site-packages\tensorflow\contrib\tpu\python\tpu\tpu_feed.py in <module>()
26 from six.moves import xrange # pylint: disable=redefined-builtin
27
---> 28 from tensorflow.compiler.xla.experimental.xla_sharding import xla_sharding
29 from tensorflow.compiler.xla.python_api import xla_shape
30 from tensorflow.contrib.tpu.python.ops import tpu_ops
ModuleNotFoundError: No module named 'tensorflow.compiler'
The above error occurred when I ran the following code: env:windows10+jupyter notebook+tensorflow1.9+python3.6
import tensorflow as tf
x_image = tf.reshape(x, [-1,24,24,3])
h_conv1 = tf.contrib.layers.conv2d(x_image, 64,5,1, "SAME",
activation_fn=tf.nn.relu)
Upvotes: 1
Views: 4555
Reputation: 28245
This error can happen if the installation of Tensorflow is incomplete (for example if "pip install tensorflow" has been interrupted.
Upvotes: 2
Reputation: 1822
I ran your example using Python 3 on a Cloud TPU (ctpu) machine, defining x
and initializing global variables as follows:
sess = tf.Session()
sess.run(tf.global_variables_initializer())
x = tf.ones(shape=[24*24*3*50], dtype=tf.float32)
x_image = tf.reshape(x, [-1,24,24,3])
h_conv1 = tf.contrib.layers.conv2d(x_image, 64,5,1, "SAME",
activation_fn=tf.nn.relu)
sess.run(h_conv1)
and it worked correctly.
Upvotes: 0