diff options
author | Kiril Gorovoy <kgorovoy@google.com> | 2016-09-15 10:01:44 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-09-15 11:17:15 -0700 |
commit | 89f358fdfd701b4118fe0f80e36f9cd098ee691e (patch) | |
tree | cbe32e8b1b36096d9cb92113c670d6e7d4a9f41d /tensorflow/core/util/example_proto_fast_parsing_test.cc | |
parent | a8bd2dea81d90338290288dad11defa154d73a43 (diff) |
Support fast parsing of concatenated serialized tf.Examples.
Change: 133282091
Diffstat (limited to 'tensorflow/core/util/example_proto_fast_parsing_test.cc')
-rw-r--r-- | tensorflow/core/util/example_proto_fast_parsing_test.cc | 17 |
1 files changed, 17 insertions, 0 deletions
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"); |