aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/example
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <nobody@tensorflow.org>2016-05-09 05:06:43 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-05-09 09:21:28 -0700
commit3f6f9f07de9bc9487452cad64998d51cf6ca5a92 (patch)
treef828c47b01cbc5471cbdc42181f2b018d9dcde73 /tensorflow/core/example
parent6ff265ebae14586db5db623b7502ddbdbc8bbd12 (diff)
Removing std::string qualification and adding requisite #includes.
Change: 121829401
Diffstat (limited to 'tensorflow/core/example')
-rw-r--r--tensorflow/core/example/feature_util.h3
-rw-r--r--tensorflow/core/example/feature_util_test.cc17
2 files changed, 19 insertions, 1 deletions
diff --git a/tensorflow/core/example/feature_util.h b/tensorflow/core/example/feature_util.h
index 972bf4e885..edfb39b213 100644
--- a/tensorflow/core/example/feature_util.h
+++ b/tensorflow/core/example/feature_util.h
@@ -56,6 +56,7 @@ limitations under the License.
#include "tensorflow/core/example/feature.pb.h"
#include "tensorflow/core/lib/core/stringpiece.h"
#include "tensorflow/core/platform/protobuf.h"
+#include "tensorflow/core/platform/types.h"
namespace tensorflow {
@@ -113,7 +114,7 @@ struct is_string
};
template <>
-struct is_string<std::string> : std::true_type {};
+struct is_string<string> : std::true_type {};
template <>
struct is_string<::tensorflow::StringPiece> : std::true_type {};
diff --git a/tensorflow/core/example/feature_util_test.cc b/tensorflow/core/example/feature_util_test.cc
index bcee0fb587..ed09234837 100644
--- a/tensorflow/core/example/feature_util_test.cc
+++ b/tensorflow/core/example/feature_util_test.cc
@@ -19,6 +19,7 @@ limitations under the License.
#include "tensorflow/core/example/example.pb.h"
#include "tensorflow/core/platform/test.h"
+#include "tensorflow/core/platform/types.h"
namespace tensorflow {
namespace {
@@ -210,5 +211,21 @@ TEST(AppendFeatureValuesTest, StringValuesUsingInitializerList) {
EXPECT_EQ("BAZ", tag_ro.Get(2));
}
+TEST(AppendFeatureValuesTest, StringVariablesUsingInitializerList) {
+ Example example;
+
+ string string1("FOO");
+ string string2("BAR");
+ string string3("BAZ");
+
+ AppendFeatureValues({string1, string2, string3}, "tag", &example);
+
+ auto tag_ro = GetFeatureValues<string>("tag", example);
+ ASSERT_EQ(3, tag_ro.size());
+ EXPECT_EQ("FOO", tag_ro.Get(0));
+ EXPECT_EQ("BAR", tag_ro.Get(1));
+ EXPECT_EQ("BAZ", tag_ro.Get(2));
+}
+
} // namespace
} // namespace tensorflow