STT-tensorflow/tensorflow/python/kernel_tests/proto/test_example.proto
A. Unique TensorFlower f776c50ca3 decode_proto: Fixed decoding of default values for enum fields.
PiperOrigin-RevId: 271043492
2019-09-24 20:52:17 -07:00

181 lines
6.4 KiB
Protocol Buffer

// Test description and protos to work with it.
syntax = "proto2";
package tensorflow.contrib.proto;
import "tensorflow/core/framework/types.proto";
// A TestCase holds a proto and assertions about how it should decode.
message TestCase {
// Batches of primitive values.
repeated TestValue values = 1;
// The batch shapes.
repeated int32 shapes = 2;
// Expected sizes for each field.
repeated int32 sizes = 3;
// Expected values for each field.
repeated FieldSpec fields = 4;
}
// FieldSpec describes the expected output for a single field.
message FieldSpec {
optional string name = 1;
optional tensorflow.DataType dtype = 2;
optional TestValue value = 3;
}
enum Color {
RED = 0;
ORANGE = 1;
YELLOW = 2;
GREEN = 3;
BLUE = 4;
INDIGO = 5;
VIOLET = 6;
}
// NOTE: This definition must be kept in sync with PackedTestValue.
message TestValue {
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;
repeated Color enum_value = 35;
// Optional fields with explicitly-specified defaults.
optional double double_value_with_default = 20 [default = 1.0];
optional float float_value_with_default = 21 [default = 2.0];
optional int64 int64_value_with_default = 22 [default = 3];
optional uint64 uint64_value_with_default = 23 [default = 4];
optional int32 int32_value_with_default = 24 [default = 5];
optional fixed64 fixed64_value_with_default = 25 [default = 6];
optional fixed32 fixed32_value_with_default = 26 [default = 7];
optional bool bool_value_with_default = 27 [default = true];
optional string string_value_with_default = 28 [default = "a"];
optional bytes bytes_value_with_default = 29
[default = "a longer default string"];
optional uint32 uint32_value_with_default = 30 [default = 9];
optional sfixed32 sfixed32_value_with_default = 31 [default = 10];
optional sfixed64 sfixed64_value_with_default = 32 [default = 11];
optional sint32 sint32_value_with_default = 33 [default = 12];
optional sint64 sint64_value_with_default = 34 [default = 13];
optional Color enum_value_with_default = 36 [default = GREEN];
extensions 100 to 199;
}
// A PackedTestValue looks exactly the same as a TestValue 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 TestValue.
//
// NOTE: This definition must be kept in sync with TestValue in every way except
// the packed=true declaration and the lack of extensions.
message PackedTestValue {
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;
repeated Color enum_value = 35;
optional double double_value_with_default = 20 [default = 1.0];
optional float float_value_with_default = 21 [default = 2.0];
optional int64 int64_value_with_default = 22 [default = 3];
optional uint64 uint64_value_with_default = 23 [default = 4];
optional int32 int32_value_with_default = 24 [default = 5];
optional fixed64 fixed64_value_with_default = 25 [default = 6];
optional fixed32 fixed32_value_with_default = 26 [default = 7];
optional bool bool_value_with_default = 27 [default = true];
optional string string_value_with_default = 28 [default = "a"];
optional bytes bytes_value_with_default = 29
[default = "a longer default string"];
optional uint32 uint32_value_with_default = 30 [default = 9];
optional sfixed32 sfixed32_value_with_default = 31 [default = 10];
optional sfixed64 sfixed64_value_with_default = 32 [default = 11];
optional sint32 sint32_value_with_default = 33 [default = 12];
optional sint64 sint64_value_with_default = 34 [default = 13];
optional Color enum_value_with_default = 36 [default = GREEN];
}
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;
}
// 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;
}
extend TestValue {
repeated PrimitiveValue ext_value = 100;
}
// The messages below are for yet-to-be created tests.
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;
}