Created
December 8, 2019 09:30
-
-
Save kazk1018/da37caa31d84b6be35d6d612eba8b7eb 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 make_sequence_record(qid, relevances, features): | |
context_feature = {"qid": _int64_feature(qid)} | |
feature_list = dict() | |
feature_list["relevance"] = tf.train.FeatureList( | |
feature=[tf.train.Feature(float_list=tf.train.FloatList(value=[x])) for x in relevances] | |
) | |
feature_list["feature"] = tf.train.FeatureList( | |
feature=[tf.train.Feature(float_list=tf.train.FloatList(value=feature)) for feature in features] | |
) | |
context = tf.train.Features(feature=context_feature) | |
feature_lists = tf.train.FeatureLists(feature_list=feature_list) | |
example = tf.train.SequenceExample(context=context, feature_lists=feature_lists) | |
return example.SerializeToString() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment