aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/proto/python/kernel_tests/test_example.proto
blob: a2c88e372bf7c6b7f14c5bb55776b66c4c06bcd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
// Test description and protos to work with it.
//
// Many of the protos in this file are for unit tests that haven't been written yet.

syntax = "proto2";

import "tensorflow/core/framework/types.proto";

package tensorflow.contrib.proto;

// A TestCase holds a proto and a bunch of assertions
// about how it should decode.
message TestCase {
  // A batch of primitives to be serialized and decoded.
  repeated RepeatedPrimitiveValue primitive = 1;
  // The shape of the batch.
  repeated int32 shape = 2;
  // Expected sizes for each field.
  repeated int32 sizes = 3;
  // Expected values for each field.
  repeated FieldSpec field = 4;
};

// FieldSpec describes the expected output for a single field.
message FieldSpec {
  optional string name = 1;
  optional tensorflow.DataType dtype = 2;
  optional RepeatedPrimitiveValue expected = 3;
};

message TestValue {
  optional PrimitiveValue primitive_value = 1;
  optional EnumValue enum_value = 2;
  optional MessageValue message_value = 3;
  optional RepeatedMessageValue repeated_message_value = 4;
  optional RepeatedPrimitiveValue repeated_primitive_value = 6;
}

message PrimitiveValue {
  optional double double_value = 1;
  optional float float_value = 2;
  optional int64 int64_value = 3;
  optional uint64 uint64_value = 4;
  optional int32 int32_value = 5;
  optional fixed64 fixed64_value = 6;
  optional fixed32 fixed32_value = 7;
  optional bool bool_value = 8;
  optional string string_value = 9;
  optional bytes bytes_value = 12;
  optional uint32 uint32_value = 13;
  optional sfixed32 sfixed32_value = 15;
  optional sfixed64 sfixed64_value = 16;
  optional sint32 sint32_value = 17;
  optional sint64 sint64_value = 18;
}

// NOTE: This definition must be kept in sync with PackedPrimitiveValue.
message RepeatedPrimitiveValue {
  repeated double double_value = 1;
  repeated float float_value = 2;
  repeated int64 int64_value = 3;
  repeated uint64 uint64_value = 4;
  repeated int32 int32_value = 5;
  repeated fixed64 fixed64_value = 6;
  repeated fixed32 fixed32_value = 7;
  repeated bool bool_value = 8;
  repeated string string_value = 9;
  repeated bytes bytes_value = 12;
  repeated uint32 uint32_value = 13;
  repeated sfixed32 sfixed32_value = 15;
  repeated sfixed64 sfixed64_value = 16;
  repeated sint32 sint32_value = 17;
  repeated sint64 sint64_value = 18;
  repeated PrimitiveValue message_value = 19;

  // Optional fields with explicitly-specified defaults.
  optional double double_default = 20 [default = 1.0];
  optional float float_default = 21 [default = 2.0];
  optional int64 int64_default = 22 [default = 3];
  optional uint64 uint64_default = 23 [default = 4];
  optional int32 int32_default = 24 [default = 5];
  optional fixed64 fixed64_default = 25 [default = 6];
  optional fixed32 fixed32_default = 26 [default = 7];
  optional bool bool_default = 27 [default = true];
  optional string string_default = 28 [default = "a"];
  optional bytes bytes_default = 29 [default = "a longer default string"];
  optional uint32 uint32_default = 30 [default = 4294967295];
  optional sfixed32 sfixed32_default = 31 [default = 10];
  optional sfixed64 sfixed64_default = 32 [default = 11];
  optional sint32 sint32_default = 33 [default = 12];
  optional sint64 sint64_default = 34 [default = 13];
}

// A PackedPrimitiveValue looks exactly the same as a RepeatedPrimitiveValue
// in the text format, but the binary serializion is different.
// We test the packed representations by loading the same test cases
// using this definition instead of RepeatedPrimitiveValue.
// NOTE: This definition must be kept in sync with RepeatedPrimitiveValue
// in every way except the packed=true declaration.
message PackedPrimitiveValue {
  repeated double double_value = 1 [packed = true];
  repeated float float_value = 2 [packed = true];
  repeated int64 int64_value = 3 [packed = true];
  repeated uint64 uint64_value = 4 [packed = true];
  repeated int32 int32_value = 5 [packed = true];
  repeated fixed64 fixed64_value = 6 [packed = true];
  repeated fixed32 fixed32_value = 7 [packed = true];
  repeated bool bool_value = 8 [packed = true];
  repeated string string_value = 9;
  repeated bytes bytes_value = 12;
  repeated uint32 uint32_value = 13 [packed = true];
  repeated sfixed32 sfixed32_value = 15 [packed = true];
  repeated sfixed64 sfixed64_value = 16 [packed = true];
  repeated sint32 sint32_value = 17 [packed = true];
  repeated sint64 sint64_value = 18 [packed = true];
  repeated PrimitiveValue message_value = 19;

  optional double double_default = 20 [default = 1.0];
  optional float float_default = 21 [default = 2.0];
  optional int64 int64_default = 22 [default = 3];
  optional uint64 uint64_default = 23 [default = 4];
  optional int32 int32_default = 24 [default = 5];
  optional fixed64 fixed64_default = 25 [default = 6];
  optional fixed32 fixed32_default = 26 [default = 7];
  optional bool bool_default = 27 [default = true];
  optional string string_default = 28 [default = "a"];
  optional bytes bytes_default = 29 [default = "a longer default string"];
  optional uint32 uint32_default = 30 [default = 4294967295];
  optional sfixed32 sfixed32_default = 31 [default = 10];
  optional sfixed64 sfixed64_default = 32 [default = 11];
  optional sint32 sint32_default = 33 [default = 12];
  optional sint64 sint64_default = 34 [default = 13];
}

message EnumValue {
  enum Color {
    RED = 0;
    ORANGE = 1;
    YELLOW = 2;
    GREEN = 3;
    BLUE = 4;
    INDIGO = 5;
    VIOLET = 6;
  };
  optional Color enum_value = 14;
  repeated Color repeated_enum_value = 15;
}


message InnerMessageValue {
  optional float float_value = 2;
  repeated bytes bytes_values = 8;
}

message MiddleMessageValue {
  repeated int32 int32_values = 5;
  optional InnerMessageValue message_value = 11;
  optional uint32 uint32_value = 13;
}

message MessageValue {
  optional double double_value = 1;
  optional MiddleMessageValue message_value = 11;
}

message RepeatedMessageValue {
  message NestedMessageValue {
    optional float float_value = 2;
    repeated bytes bytes_values = 8;
  }

  repeated NestedMessageValue message_values = 11;
}

// Message containing fields with field numbers higher than any field above. An
// instance of this message is prepended to each binary message in the test to
// exercise the code path that handles fields encoded out of order of field
// number.
message ExtraFields {
  optional string string_value = 1776;
  optional bool bool_value = 1777;
}