0

I write such code segments.

import tensorflow as tf
from tensorflow.core.example import example_pb2

# Write to tf.Example
            tf_example = example_pb2.Example()
            tf_example.features.feature['article'].byytes_list.value.extend([article.encode()])
            tf_example.features.feature['abstract'].bytes_list.value.extend([abstract.encode()])
            tf_example_str = tf_example.SerializeToString()
            str_len = len(tf_example_str)
            writer.write(struct.pack('q', str_len))
            writer.write(struct.pack('%ds' % str_len, tf_example_str))

But I found that there is no Example() class in example_pb2. What should I do?

0 Answers0