def parse_sequence_example(serialized_example):
context, sequence = tf.parse_single_sequence_example(
serialized=serialized_example,
context_features={
"length": tf.FixedLenFeature([], dtype=tf.int64)
},
sequence_features={
"source": tf.FixedLenSequenceFeature([], dtype=tf.int64),
"target": tf.FixedLenSequenceFeature([], dtype=tf.int64)
}
)
return (context['length'], sequence['source'], sequence['target'])
评论列表
文章目录