Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: module 'tensorflow.io' has no attribute 'experimental'

I am trying to call a function from tensorflow to decode a tiff image, while i am running the notebook on kaggle notebooks and in this line:

img = tfio.experimental.image.decode_tiff(img, channels=1)

It gives me the error:

AttributeError: in user code:

<ipython-input-5-d30698f56813>:11 load  *
    img = tfio.experimental.image.decode_tiff(img, channels=1)

AttributeError: module 'tensorflow.io' has no attribute 'experimental'

I'm currently importing tensorflow.io like this:

import tensorflow.io as tfio

And my current version of: print(f"Tensorflow ver. {tf.__version__}") is

Tensorflow ver. 2.3.0


1 Answers

Tensorflow I/O does not come with Tensorflow, and it must be installed separately via pip; from the repo (emphasis mine):

TensorFlow I/O is a collection of file systems and file formats that are not available in TensorFlow's built-in support.

Moreover, it is not imported like that.

What you should do is install it via pip:

!pip install tensorflow-io

and verify that you get the latest version v0.15.0, as it is currently the only one compatible with TF 2.3 (source):

import tensorflow_io as tfio
tfio.__version__
# 0.15.0

Notice the different import - tensorflow_io, not tensorflow.io; this is demonstrated also in the simple usage examples in Github.

like image 73
desertnaut Avatar answered Oct 20 '25 04:10

desertnaut



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!