There is a small snippet about loading sparse data but I have no idea how to use it.
SparseTensors don\'t play well with queues. If you use SparseTensors
First, to explain what that documentation means:
For dense data usually you are doing:
Serialized Example (from reader) -> parse_single_example -> batch queue -> use it.
For sparse data you currently need to do:
Serialized Example (from reader) -> batch queue -> parse_example -> use it.
An example of this would be:
reader = tf.TFRecordReader()
_, serialized_example = reader.read(filename_queue)
batch_serialized_examples = tf.shuffle_batch([serialized_example], batch_size)
feature_to_type = {
'label': tf.FixedLenFeature([1], dtype=tf.int64),
'sparse_feature': tf.VarLenFeature(dtype=tf.int64)
}
features = tf.parse_example(batch_serialized_examples, feature_to_type)
Note, shuffle_batch takes a series of strings and returns batch of strings. label should be fixed len of rank == 1 from your example.