aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/example
diff options
context:
space:
mode:
authorGravatar Vijay Vasudevan <vrv@google.com>2015-12-02 15:04:40 -0800
committerGravatar Vijay Vasudevan <vrv@google.com>2015-12-02 15:04:40 -0800
commitbf6b536bde7d8060c489b51fedb58968b8cbfd7c (patch)
treeabdafce531563adae9a811d8994477f020979dec /tensorflow/core/example
parentfa095c5db0ac9cfe2328a19b32ae208e58e3746a (diff)
TensorFlow: Upstream changes to git.
Change 109240606 Fix typo Change 109240358 Fix bug in Concat's shape inference due to legacy scalar handling. The shape function was inadvertently converting outputs of unknown shape (rank=None) to vectors of unknown length (rank=1), due to inability to distinguish between legacy scalars and vectors, because `max(1, None)` is 1. Change 109237152 Remove numarray requirement in python_config. Change 109234003 Fix typo in elu documentation. Change 109232946 Python must now be configured via ./configure script Change 109232134 Backported fixes to the tensor comparison operators from the public Eigen repository Change 109231761 Test invalid inputs to softmax_cross_entropy_with_logits. Change 109230218 Backported fixes to the tensor comparison operators from the public Eigen repository Change 109229915 Correct comments in seq2seq to show the right input types for embedding models. (Thanks to hugman@github for bringing this up.) Change 109229118 Fix resize_images example in documentation and allow resize_images to run on a single image with partially-known shape. Change 109228940 Fix demo and node add/remove button spacing Change 109227909 Include Elu in the NN docs. Change 109227059 Adds variable_op_scope and makes variable_scope always add a name_scope. This creates an op scope for variables that makes it easy to create independent operations with a default name by making that name unique for the current scope and it allows explicit names that are not made unique. Change 109224492 Streamline yuv -> rgb conversion to be done in one pass in native code. The entire process now takes ~2ms (including the ByteBuffer.get() calls), down from 10+ ms when the arrays were being interleaved in Java prior to conversion. Also abstracting common yuv->rgb color conversion into helper method. Change 109224389 Add ability to move nodes in and out of auxiliary nodes in graph. Change 109217177 Update generated Op docs. Change 109215030 Implementation of the ELU activation function: http://arxiv.org/abs/1511.07289 Change 109209848 When GPUBFCAllocator runs out of memory, also log a summary of chunks in use by size. Change 109206569 Switched to the public version of the Eigen::sign method since it supports complex numbers. Change 109199813 Modify tensorflow.SequenceExample to support multiple-length sequences. Base CL: 109241553
Diffstat (limited to 'tensorflow/core/example')
-rw-r--r--tensorflow/core/example/example.proto201
-rw-r--r--tensorflow/core/example/feature.proto42
2 files changed, 218 insertions, 25 deletions
diff --git a/tensorflow/core/example/example.proto b/tensorflow/core/example/example.proto
index 4acd8ccd72..f4d946dcf0 100644
--- a/tensorflow/core/example/example.proto
+++ b/tensorflow/core/example/example.proto
@@ -7,7 +7,21 @@ import "tensorflow/core/example/feature.proto";
package tensorflow;
-// Example for a movie recommendation application:
+// An Example is a mostly-normalized data format for storing data for
+// training and inference. It contains a key-value store (features); where
+// each key (string) maps to a Feature message (which is oneof packed BytesList,
+// FloatList, or Int64List). This flexible and compact format allows the
+// storage of large amounts of typed data, but requires that the data shape
+// and use be determined by the configuration files and parsers that are used to
+// read and write this format. That is, the Example is mostly *not* a
+// self-describing format. In TensorFlow, Examples are read in row-major
+// format, so any configuration that describes data with rank-2 or above
+// should keep this in mind. For example, to store an M x N matrix of Bytes,
+// the BytesList must contain M*N bytes, with M rows of N contiguous values
+// each. That is, the BytesList value must store the matrix as:
+// .... row 0 .... .... row 1 .... // ........... // ... row M-1 ....
+//
+// An Example for a movie recommendation application:
// features {
// feature {
// key: "age"
@@ -58,7 +72,7 @@ package tensorflow;
// }
// }
//
-// A conformant data set obeys the following conventions:
+// A conformant Example data set obeys the following conventions:
// - If a Feature K exists in one example with data type T, it must be of
// type T in all other examples when present. It may be omitted.
// - The number of instances of Feature K list data may vary across examples,
@@ -72,23 +86,182 @@ message Example {
Features features = 1;
};
-// Example representing a ranking instance.
-message RankingExample {
- Features context = 1;
- repeated Features positive = 2;
- repeated Features negative = 3;
-};
+// A SequenceExample is an Example representing one or more sequences, and
+// some context. The context contains features which apply to the entire
+// example. The feature_lists contain a key, value map where each key is
+// associated with a repeated set of Features (a FeatureList).
+//
+// A SequenceExample for a movie recommendation application:
+//
+// context: {
+// feature: {
+// key : "locale"
+// value: {
+// bytes_list: {
+// value: [ "pt_BR" ]
+// }
+// }
+// }
+// feature: {
+// key : "age"
+// value: {
+// float_list: {
+// value: [ 19.0 ]
+// }
+// }
+// }
+// feature: {
+// key : "favorites"
+// value: {
+// bytes_list: {
+// value: [ "Majesty Rose", "Savannah Outen", "One Direction" ]
+// }
+// }
+// }
+// }
+// feature_lists: {
+// feature_list: {
+// key : "movie_ratings"
+// value: {
+// feature: {
+// float_list: {
+// value: [ 4.5 ]
+// }
+// }
+// feature: {
+// float_list: {
+// value: [ 5.0 ]
+// }
+// }
+// }
+// }
+// feature_list: {
+// key : "movie_names"
+// value: {
+// feature: {
+// bytes_list: {
+// value: [ "The Shawshank Redemption" ]
+// }
+// }
+// feature: {
+// bytes_list: {
+// value: [ "Fight Club" ]
+// }
+// }
+// }
+// }
+// }
+//
+// A conformant SequenceExample data set obeys the following conventions:
+//
+// Context:
+// - All conformant context features K must obey the same conventions as
+// a conformant Example's features (see above).
+// Feature lists:
+// - A FeatureList L may be missing in an example; it is up to the
+// parser configuration to determine if this is allowed or considered
+// an empty list (zero length).
+// - If a FeatureList L exists, it may be empty (zero length).
+// - If a FeatureList L is non-empty, all features within the FeatureList
+// must have data type T, and all features within the FeatureList must
+// have the same size.
+// - If a FeatureList L exists in one example with data type T,
+// it must be of type T in all other examples when present.
+// - If a FeatureList L exists in one example having features' sizes all S,
+// these sizes must be S in all other examples when present.
+//
+// Examples of conformant and non-conformant examples' FeatureLists:
+//
+// Conformant FeatureLists:
+// feature_lists: { feature_list: {
+// key: "movie_ratings"
+// value: { feature: { float_list: { value: [ 4.5 ] } }
+// feature: { float_list: { value: [ 5.0 ] } } }
+// } }
+//
+// Non-conformant FeatureLists (mismatched types):
+// feature_lists: { feature_list: {
+// key: "movie_ratings"
+// value: { feature: { float_list: { value: [ 4.5 ] } }
+// feature: { int64_list: { value: [ 5 ] } } }
+// } }
+//
+// Non-conformant FeatureLists (mismatched sizes):
+// feature_lists: { feature_list: {
+// key: "movie_ratings"
+// value: { feature: { float_list: { value: [ 4.5 ] } }
+// feature: { float_list: { value: [ 5.0, 6.0 ] } } }
+// } }
+//
+// Conformant pair of SequenceExample
+// feature_lists: { feature_list: {
+// key: "movie_ratings"
+// value: { feature: { float_list: { value: [ 4.5 ] } }
+// feature: { float_list: { value: [ 5.0 ] } } }
+// } }
+// and:
+// feature_lists: { feature_list: {
+// key: "movie_ratings"
+// value: { feature: { float_list: { value: [ 4.5 ] } }
+// feature: { float_list: { value: [ 5.0 ] } }
+// feature: { float_list: { value: [ 2.0 ] } } }
+// } }
+//
+// Conformant pair of SequenceExample
+// feature_lists: { feature_list: {
+// key: "movie_ratings"
+// value: { feature: { float_list: { value: [ 4.5 ] } }
+// feature: { float_list: { value: [ 5.0 ] } } }
+// } }
+// and:
+// feature_lists: { feature_list: {
+// key: "movie_ratings"
+// value: { }
+// } }
+//
+// Conditionally conformant pair of SequenceExample, the parser configuration
+// determines if the second feature_lists is consistent (zero-length) or
+// invalid (missing "movie_ratings"):
+// feature_lists: { feature_list: {
+// key: "movie_ratings"
+// value: { feature: { float_list: { value: [ 4.5 ] } }
+// feature: { float_list: { value: [ 5.0 ] } } }
+// } }
+// and:
+// feature_lists: { }
+//
+// Non-conformant pair of SequenceExample (mismatched types)
+// feature_lists: { feature_list: {
+// key: "movie_ratings"
+// value: { feature: { float_list: { value: [ 4.5 ] } }
+// feature: { float_list: { value: [ 5.0 ] } } }
+// } }
+// and:
+// feature_lists: { feature_list: {
+// key: "movie_ratings"
+// value: { feature: { int64_list: { value: [ 4 ] } }
+// feature: { int64_list: { value: [ 5 ] } }
+// feature: { int64_list: { value: [ 2 ] } } }
+// } }
+//
+// Non-conformant pair of SequenceExample (mismatched sizes)
+// feature_lists: { feature_list: {
+// key: "movie_ratings"
+// value: { feature: { float_list: { value: [ 4.5 ] } }
+// feature: { float_list: { value: [ 5.0 ] } } }
+// } }
+// and:
+// feature_lists: { feature_list: {
+// key: "movie_ratings"
+// value: { feature: { float_list: { value: [ 4.0, 5.0 ] } }
+// feature: { float_list: { value: [ 5.0, 3.0 ] } }
+// } }
-// Example representing a sequence.
-// The context contains features which apply to the entire sequence.
-// Each element in example represents an entry in the sequence.
message SequenceExample {
Features context = 1;
- repeated Features features = 2;
+ FeatureLists feature_lists = 2;
};
-// Example representing a list of feature maps.
-// The context contains features which apply to all feature maps.
message InferenceExample {
Features context = 1;
repeated Features features = 2;
diff --git a/tensorflow/core/example/feature.proto b/tensorflow/core/example/feature.proto
index 69f1923360..52d5fac441 100644
--- a/tensorflow/core/example/feature.proto
+++ b/tensorflow/core/example/feature.proto
@@ -6,7 +6,8 @@
// - float
// - int64
//
-// Base features are contained in Lists which may hold zero or more values.
+// A Feature contains Lists which may hold zero or more values. These
+// lists are the base values BytesList, FloatList, Int64List.
//
// Features are organized into categories by name. The Features message
// contains the mapping from name to Feature.
@@ -50,12 +51,25 @@
// value: 9.99
// }}
// }
+//
syntax = "proto3";
// option cc_enable_arenas = true;
package tensorflow;
+// Containers to hold repeated fundamental values.
+message BytesList {
+ repeated bytes value = 1;
+}
+message FloatList {
+ repeated float value = 1 [packed = true];
+}
+message Int64List {
+ repeated int64 value = 1 [packed = true];
+}
+
+// Containers for non-sequential data.
message Feature {
// Each feature can be exactly one kind.
oneof kind {
@@ -70,13 +84,19 @@ message Features {
map<string, Feature> feature = 1;
};
-// Containers to hold repeated fundamental features.
-message BytesList {
- repeated bytes value = 1;
-}
-message FloatList {
- repeated float value = 1 [packed = true];
-}
-message Int64List {
- repeated int64 value = 1 [packed = true];
-}
+// Containers for sequential data.
+//
+// A FeatureList contains lists of Features. These may hold zero or more
+// Feature values.
+//
+// FeatureLists are organized into categories by name. The FeatureLists message
+// contains the mapping from name to FeatureList.
+//
+message FeatureList {
+ repeated Feature feature = 1;
+};
+
+message FeatureLists {
+ // Map from feature name to feature list.
+ map<string, FeatureList> feature_list = 1;
+};