• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Protocol messages for describing features for machine learning model
2// training or inference.
3//
4// There are three base Feature types:
5//   - bytes
6//   - float
7//   - int64
8//
9// A Feature contains Lists which may hold zero or more values.  These
10// lists are the base values BytesList, FloatList, Int64List.
11//
12// Features are organized into categories by name.  The Features message
13// contains the mapping from name to Feature.
14//
15// Example Features for a movie recommendation application:
16//   feature {
17//     key: "age"
18//     value { float_list {
19//       value: 29.0
20//     }}
21//   }
22//   feature {
23//     key: "movie"
24//     value { bytes_list {
25//       value: "The Shawshank Redemption"
26//       value: "Fight Club"
27//     }}
28//   }
29//   feature {
30//     key: "movie_ratings"
31//     value { float_list {
32//       value: 9.0
33//       value: 9.7
34//     }}
35//   }
36//   feature {
37//     key: "suggestion"
38//     value { bytes_list {
39//       value: "Inception"
40//     }}
41//   }
42//   feature {
43//     key: "suggestion_purchased"
44//     value { int64_list {
45//       value: 1
46//     }}
47//   }
48//   feature {
49//     key: "purchase_price"
50//     value { float_list {
51//       value: 9.99
52//     }}
53//   }
54//
55
56syntax = "proto3";
57
58package tensorflow;
59
60option cc_enable_arenas = true;
61option java_outer_classname = "FeatureProtos";
62option java_multiple_files = true;
63option java_package = "org.tensorflow.example";
64option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/example/example_protos_go_proto";
65
66// Containers to hold repeated fundamental values.
67message BytesList {
68  repeated bytes value = 1;
69}
70message FloatList {
71  repeated float value = 1 [packed = true];
72}
73message Int64List {
74  repeated int64 value = 1 [packed = true];
75}
76
77// Containers for non-sequential data.
78message Feature {
79  // Each feature can be exactly one kind.
80  oneof kind {
81    BytesList bytes_list = 1;
82    FloatList float_list = 2;
83    Int64List int64_list = 3;
84  }
85}
86
87message Features {
88  // Map from feature name to feature.
89  map<string, Feature> feature = 1;
90}
91
92// Containers for sequential data.
93//
94// A FeatureList contains lists of Features.  These may hold zero or more
95// Feature values.
96//
97// FeatureLists are organized into categories by name.  The FeatureLists message
98// contains the mapping from name to FeatureList.
99//
100message FeatureList {
101  repeated Feature feature = 1;
102}
103
104message FeatureLists {
105  // Map from feature name to feature list.
106  map<string, FeatureList> feature_list = 1;
107}
108