aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/hlo_parser_test.cc
diff options
context:
space:
mode:
authorGravatar Justin Lebar <jlebar@google.com>2018-08-30 19:28:53 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-30 19:32:45 -0700
commit1cb6544826551524f0f53f3e9632f71e67ea7851 (patch)
tree917b987f65cbb67a6547272368d61b59b3b924e3 /tensorflow/compiler/xla/service/hlo_parser_test.cc
parent25be987034e268f682abefad6bd86458a981e567 (diff)
[XLA] Add ParsePaddingConfigOnly to HLO parser.
PiperOrigin-RevId: 211023297
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_parser_test.cc')
-rw-r--r--tensorflow/compiler/xla/service/hlo_parser_test.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_parser_test.cc b/tensorflow/compiler/xla/service/hlo_parser_test.cc
index ba07ec432e..c25af2d751 100644
--- a/tensorflow/compiler/xla/service/hlo_parser_test.cc
+++ b/tensorflow/compiler/xla/service/hlo_parser_test.cc
@@ -1725,6 +1725,25 @@ TEST_F(HloParserTest, ParseConvolutionDimensionNumbers) {
EXPECT_EQ(original, ConvolutionDimensionNumbersToString(dnums));
}
+TEST_F(HloParserTest, ParsePaddingConfigNoInteriorPadding) {
+ const string original = "0_1x2_3";
+ TF_ASSERT_OK_AND_ASSIGN(PaddingConfig dnums, ParsePaddingConfig(original));
+ EXPECT_EQ(original, PaddingConfigToString(dnums));
+}
+
+TEST_F(HloParserTest, ParsePaddingConfigInteriorPadding) {
+ const string original = "0_1_0x2_3_4";
+ TF_ASSERT_OK_AND_ASSIGN(PaddingConfig dnums, ParsePaddingConfig(original));
+ EXPECT_EQ(original, PaddingConfigToString(dnums));
+}
+
+TEST_F(HloParserTest, ParsePaddingConfigInteriorPaddingImplicitZeroDim) {
+ TF_ASSERT_OK_AND_ASSIGN(PaddingConfig dnums, ParsePaddingConfig("0_1x2_3_4"));
+ // The extra "_0" gets added to the canonical string because the other dim has
+ // interior padding.
+ EXPECT_EQ("0_1_0x2_3_4", PaddingConfigToString(dnums));
+}
+
TEST_F(HloParserTest, NontupleInfeed) {
const string original = R"(HloModule nontuple_infeed:
ENTRY nontuple_infeed {