Skip to content

iterate example from dataset error #3

@Ruohan1

Description

@Ruohan1

ValueError Traceback (most recent call last)
in ()
----> 1 new_dataset = dataset.map(parse_function)
2 iterator = new_dataset.make_one_shot_iterator()
3 next_element = iterator.get_next()
4
5 sess = tf.InteractiveSession()

/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/data/python/ops/dataset_ops.pyc in map(self, map_func, num_threads, output_buffer_size)
811 A Dataset.
812 """
--> 813 return MapDataset(self, map_func, num_threads, output_buffer_size)
814
815 def flat_map(self, map_func):

/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/data/python/ops/dataset_ops.pyc in init(self, input_dataset, map_func, num_threads, output_buffer_size)
1434
1435 self._map_func = tf_map_func
-> 1436 self._map_func.add_to_graph(ops.get_default_graph())
1437 if num_threads is not None:
1438 self._num_threads = ops.convert_to_tensor(

/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/function.pyc in add_to_graph(self, g)
617 def add_to_graph(self, g):
618 """Adds this function into the graph g."""
--> 619 self._create_definition_if_needed()
620
621 # pylint: disable=protected-access

/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/data/python/framework/function.pyc in _create_definition_if_needed(self)
165 # Call func and gather the output tensors.
166 with vs.variable_scope("", custom_getter=temp_graph.getvar):
--> 167 outputs = self._func(*inputs)
168 # If func only returned one value, make it a tuple.
169 if not isinstance(outputs, (list, tuple)):

/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/data/python/ops/dataset_ops.pyc in tf_map_func(*args)
1422 ret = map_func(*nested_args)
1423 else:
-> 1424 ret = map_func(nested_args)
1425
1426 # Extract shape information from the returned values.

in parse_function(example_proto)
15 'tensor_shape': tf.FixedLenFeature(shape=(3,), dtype=tf.int64)}
16 # parse all features in a single example according to the dics
---> 17 parsed_example = tf.parse_single_example(example_proto, dics)
18 # decode string
19 parsed_example['tensor'] = tf.decode_raw(parsed_example['tensor'], tf.uint8)

/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/parsing_ops.pyc in parse_single_example(serialized, features, name, example_names)
742 dense_shapes) = _features_to_raw_params(
743 features,
--> 744 [VarLenFeature, FixedLenFeature, FixedLenSequenceFeature, SparseFeature])
745 outputs = _parse_single_example_raw(
746 serialized, example_names, sparse_keys, sparse_types, dense_keys,

/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/parsing_ops.pyc in _features_to_raw_params(features, types)
203 raise ValueError("Unsupported VarLenFeature %s.", feature)
204 if not feature.dtype:
--> 205 raise ValueError("Missing type for feature %s." % key)
206 sparse_keys.append(key)
207 sparse_types.append(feature.dtype)

ValueError: Missing type for feature matrix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions