Created
September 25, 2020 11:33
-
-
Save ntakouris/93b1a7e5e047617d5fa6ed78a77405a9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def serialize_example(feature0, feature1, feature2, feature3): | |
""" | |
Creates a tf.train.Example message ready to be written to a file. | |
""" | |
# Create a dictionary mapping the feature name to the tf.train.Example-compatible | |
# data type. | |
feature = { | |
'feature0': _int64_feature(feature0), | |
'feature1': _int64_feature(feature1), | |
'feature2': _bytes_feature(feature2), | |
'feature3': _float_feature(feature3), | |
} | |
# Create a Features message using tf.train.Example. | |
example_proto = tf.train.Example(features=tf.train.Features(feature=feature)) | |
return example_proto.SerializeToString() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment