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