From 89f358fdfd701b4118fe0f80e36f9cd098ee691e Mon Sep 17 00:00:00 2001 From: Kiril Gorovoy Date: Thu, 15 Sep 2016 10:01:44 -0800 Subject: Support fast parsing of concatenated serialized tf.Examples. Change: 133282091 --- tensorflow/core/util/example_proto_fast_parsing_test.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tensorflow/core/util/example_proto_fast_parsing_test.cc') diff --git a/tensorflow/core/util/example_proto_fast_parsing_test.cc b/tensorflow/core/util/example_proto_fast_parsing_test.cc index 9da3f6ad2a..0590d801c3 100644 --- a/tensorflow/core/util/example_proto_fast_parsing_test.cc +++ b/tensorflow/core/util/example_proto_fast_parsing_test.cc @@ -63,6 +63,23 @@ void TestCorrectness(const string& serialized) { // TestCorrectness(example); // } +// Test that concatenating two Example protos in their serialized string +// representations gets parsed identically by TestFastParse(..) and the regular +// Example.ParseFromString(..). +TEST(FastParse, SingleInt64WithContext) { + Example example; + (*example.mutable_features()->mutable_feature())["age"] + .mutable_int64_list() + ->add_value(13); + + Example context; + (*context.mutable_features()->mutable_feature())["zipcode"] + .mutable_int64_list() + ->add_value(94043); + + TestCorrectness(strings::StrCat(Serialize(example), Serialize(context))); +} + TEST(FastParse, NonPacked) { TestCorrectness( "\x0a\x0e\x0a\x0c\x0a\x03\x61\x67\x65\x12\x05\x1a\x03\x0a\x01\x0d"); -- cgit v1.2.3