Parse batch of SequenceExample

912 Views Asked by At

There is function to parse SequenceExample --> tf.parse_single_sequence_example().

But it parses only single SequenceExample, which is not effective.

Is there any possibility to parse a batch of SequenceExamples?

tf.parse_example can parse many Examples. Documentation for tf.parse_example contain a little info about SequenceExample:

Each FixedLenSequenceFeature df maps to a Tensor of the specified type (or tf.float32 if not specified) and shape (serialized.size(), None) + df.shape. All examples in serialized will be padded with default_value along the second dimension.

But it is not clear, how to do that. Have not found any examples in google.

Is it possible to parse many SequenceExamples using parse_example() or may be other function exists?

Edit: Where can I ask question to tensorflow developers: does they plan to implement parse function for multiple SequenceExample -s?

Any help ll be appreciated.

1

There are 1 best solutions below

2
On

If you have many small sequences where batching at this stage is important, I would recommend VarLenFeatures or FixedLenSequenceFeatures with regular Example protos (which, as you note, can be parsed in batches with parse_example). For examples of this, see the unit tests associated with example parsing (testSerializedContainingSparse parses Examples with FixedLenSequenceFeatures).

SequenceExamples are more geared toward cases where there is significant amounts of preprocessing work to be done for each SequenceExample (which can be done in parallel with queues). parse_example does does not support SequenceExamples.