Samar Pratap Singh
Samar Pratap Singh

Reputation: 531

AttributeError: module 'tensorflow._api.v2.io' has no attribute 'tf_record_iterator'

I have a file named as train00.tfrecord, I want to read it via tensorflow. So I wrote the following code.

frame_lvl_record = "frame-sample/frame/train00.tfrecord"
for example in tf.io.tf_record_iterator(frame_lvl_record):
    print(example)

But it returned the following error.

AttributeError                            Traceback (most recent call last)
/tmp/ipykernel_20529/2760031393.py in <module>
----> 1 for example in tf.io.tf_record_iterator(frame_lvl_record):
      2     print(example)

AttributeError: module 'tensorflow._api.v2.io' has no attribute 'tf_record_iterator'

How can I solve this dependency issue?

Upvotes: 1

Views: 4203

Answers (1)

Bharat Natrayn
Bharat Natrayn

Reputation: 130

'''USE THIS COMMAND TO READ THE TFRecordDataset

data=tf.data.TFRecordDataset("filenames")                     
n=10          
for raw_record in data.take(n):                              
    print(repr(raw_record))      

'''

Upvotes: 4

Related Questions