def example_parser(self, filename_queue):
reader = tf.TFRecordReader()
key, record_string = reader.read(filename_queue)
features = {
'labels': tf.FixedLenSequenceFeature([], tf.int64),
'tokens': tf.FixedLenSequenceFeature([], tf.int64),
'shapes': tf.FixedLenSequenceFeature([], tf.int64),
'chars': tf.FixedLenSequenceFeature([], tf.int64),
'seq_len': tf.FixedLenSequenceFeature([], tf.int64),
'tok_len': tf.FixedLenSequenceFeature([], tf.int64),
}
_, example = tf.parse_single_sequence_example(serialized=record_string, sequence_features=features)
labels = example['labels']
tokens = example['tokens']
shapes = example['shapes']
chars = example['chars']
seq_len = example['seq_len']
tok_len = example['tok_len']
# context = c['context']
return labels, tokens, shapes, chars, seq_len, tok_len
# return labels, tokens, labels, labels, labels
评论列表
文章目录