• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Test description and protos to work with it.
2
3syntax = "proto2";
4
5import "tensorflow/core/framework/types.proto";
6
7package tensorflow.contrib.proto;
8
9// A TestCase holds a proto and assertions about how it should decode.
10message TestCase {
11  // Batches of primitive values.
12  repeated TestValue values = 1;
13  // The batch shapes.
14  repeated int32 shapes = 2;
15  // Expected sizes for each field.
16  repeated int32 sizes = 3;
17  // Expected values for each field.
18  repeated FieldSpec fields = 4;
19};
20
21// FieldSpec describes the expected output for a single field.
22message FieldSpec {
23  optional string name = 1;
24  optional tensorflow.DataType dtype = 2;
25  optional TestValue value = 3;
26};
27
28// NOTE: This definition must be kept in sync with PackedTestValue.
29message TestValue {
30  repeated double double_value = 1;
31  repeated float float_value = 2;
32  repeated int64 int64_value = 3;
33  repeated uint64 uint64_value = 4;
34  repeated int32 int32_value = 5;
35  repeated fixed64 fixed64_value = 6;
36  repeated fixed32 fixed32_value = 7;
37  repeated bool bool_value = 8;
38  repeated string string_value = 9;
39  repeated bytes bytes_value = 12;
40  repeated uint32 uint32_value = 13;
41  repeated sfixed32 sfixed32_value = 15;
42  repeated sfixed64 sfixed64_value = 16;
43  repeated sint32 sint32_value = 17;
44  repeated sint64 sint64_value = 18;
45  repeated PrimitiveValue message_value = 19;
46
47  // Optional fields with explicitly-specified defaults.
48  optional double double_value_with_default = 20 [default = 1.0];
49  optional float float_value_with_default = 21 [default = 2.0];
50  optional int64 int64_value_with_default = 22 [default = 3];
51  optional uint64 uint64_value_with_default = 23 [default = 4];
52  optional int32 int32_value_with_default = 24 [default = 5];
53  optional fixed64 fixed64_value_with_default = 25 [default = 6];
54  optional fixed32 fixed32_value_with_default = 26 [default = 7];
55  optional bool bool_value_with_default = 27 [default = true];
56  optional string string_value_with_default = 28 [default = "a"];
57  optional bytes bytes_value_with_default = 29
58      [default = "a longer default string"];
59  optional uint32 uint32_value_with_default = 30 [default = 9];
60  optional sfixed32 sfixed32_value_with_default = 31 [default = 10];
61  optional sfixed64 sfixed64_value_with_default = 32 [default = 11];
62  optional sint32 sint32_value_with_default = 33 [default = 12];
63  optional sint64 sint64_value_with_default = 34 [default = 13];
64
65  extensions 100 to 199;
66}
67
68// A PackedTestValue looks exactly the same as a TestValue in the text format,
69// but the binary serializion is different. We test the packed representations
70// by loading the same test cases using this definition instead of TestValue.
71//
72// NOTE: This definition must be kept in sync with TestValue in every way except
73// the packed=true declaration and the lack of extensions.
74message PackedTestValue {
75  repeated double double_value = 1 [packed = true];
76  repeated float float_value = 2 [packed = true];
77  repeated int64 int64_value = 3 [packed = true];
78  repeated uint64 uint64_value = 4 [packed = true];
79  repeated int32 int32_value = 5 [packed = true];
80  repeated fixed64 fixed64_value = 6 [packed = true];
81  repeated fixed32 fixed32_value = 7 [packed = true];
82  repeated bool bool_value = 8 [packed = true];
83  repeated string string_value = 9;
84  repeated bytes bytes_value = 12;
85  repeated uint32 uint32_value = 13 [packed = true];
86  repeated sfixed32 sfixed32_value = 15 [packed = true];
87  repeated sfixed64 sfixed64_value = 16 [packed = true];
88  repeated sint32 sint32_value = 17 [packed = true];
89  repeated sint64 sint64_value = 18 [packed = true];
90  repeated PrimitiveValue message_value = 19;
91
92  optional double double_value_with_default = 20 [default = 1.0];
93  optional float float_value_with_default = 21 [default = 2.0];
94  optional int64 int64_value_with_default = 22 [default = 3];
95  optional uint64 uint64_value_with_default = 23 [default = 4];
96  optional int32 int32_value_with_default = 24 [default = 5];
97  optional fixed64 fixed64_value_with_default = 25 [default = 6];
98  optional fixed32 fixed32_value_with_default = 26 [default = 7];
99  optional bool bool_value_with_default = 27 [default = true];
100  optional string string_value_with_default = 28 [default = "a"];
101  optional bytes bytes_value_with_default = 29
102      [default = "a longer default string"];
103  optional uint32 uint32_value_with_default = 30 [default = 9];
104  optional sfixed32 sfixed32_value_with_default = 31 [default = 10];
105  optional sfixed64 sfixed64_value_with_default = 32 [default = 11];
106  optional sint32 sint32_value_with_default = 33 [default = 12];
107  optional sint64 sint64_value_with_default = 34 [default = 13];
108}
109
110message PrimitiveValue {
111  optional double double_value = 1;
112  optional float float_value = 2;
113  optional int64 int64_value = 3;
114  optional uint64 uint64_value = 4;
115  optional int32 int32_value = 5;
116  optional fixed64 fixed64_value = 6;
117  optional fixed32 fixed32_value = 7;
118  optional bool bool_value = 8;
119  optional string string_value = 9;
120  optional bytes bytes_value = 12;
121  optional uint32 uint32_value = 13;
122  optional sfixed32 sfixed32_value = 15;
123  optional sfixed64 sfixed64_value = 16;
124  optional sint32 sint32_value = 17;
125  optional sint64 sint64_value = 18;
126}
127
128// Message containing fields with field numbers higher than any field above.
129// An instance of this message is prepended to each binary message in the test
130// to exercise the code path that handles fields encoded out of order of field
131// number.
132message ExtraFields {
133  optional string string_value = 1776;
134  optional bool bool_value = 1777;
135}
136
137extend TestValue {
138  repeated PrimitiveValue ext_value = 100;
139}
140
141// The messages below are for yet-to-be created tests.
142
143message EnumValue {
144  enum Color {
145    RED = 0;
146    ORANGE = 1;
147    YELLOW = 2;
148    GREEN = 3;
149    BLUE = 4;
150    INDIGO = 5;
151    VIOLET = 6;
152  };
153  optional Color enum_value = 14;
154  repeated Color repeated_enum_value = 15;
155}
156
157
158message InnerMessageValue {
159  optional float float_value = 2;
160  repeated bytes bytes_values = 8;
161}
162
163message MiddleMessageValue {
164  repeated int32 int32_values = 5;
165  optional InnerMessageValue message_value = 11;
166  optional uint32 uint32_value = 13;
167}
168
169message MessageValue {
170  optional double double_value = 1;
171  optional MiddleMessageValue message_value = 11;
172}
173
174message RepeatedMessageValue {
175  message NestedMessageValue {
176    optional float float_value = 2;
177    repeated bytes bytes_values = 8;
178  }
179
180  repeated NestedMessageValue message_values = 11;
181}
182