def decode(self, serialized_example_proto):
"""Decode serialized tf.Example as a tf.transform encoded dict."""
if self._decode_example_cache is None:
# Initialize the decode Example cache (used by this and all subsequent
# calls to decode).
self._decode_example_cache = tf.train.Example()
example = self._decode_example_cache
example.ParseFromString(serialized_example_proto)
feature_map = example.features.feature
return {feature_handler.name: feature_handler.parse_value(feature_map)
for feature_handler in self._feature_handlers}
评论列表
文章目录