Skip to content

Commit

Permalink
Add test coverage for example parsing with a feature that is an empty…
Browse files Browse the repository at this point in the history
… string.

PiperOrigin-RevId: 179875758
  • Loading branch information
mrry authored and tensorflower-gardener committed Dec 22, 2017
1 parent e38cf4c commit 6b8b9e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def testSerializedContainingDense(self):
bname: bytes_feature([b"b0_str"]),
})), example(features=features({
aname: float_feature([-1, -1]),
bname: bytes_feature([b"b1"]),
bname: bytes_feature([b""]),
}))
]

Expand All @@ -419,7 +419,7 @@ def testSerializedContainingDense(self):
bname: np.array(["b0_str"], dtype=bytes).reshape(1, 1, 1, 1)
}, {
aname: np.array([-1, -1], dtype=np.float32).reshape(1, 2, 1),
bname: np.array(["b1"], dtype=bytes).reshape(1, 1, 1, 1)
bname: np.array([""], dtype=bytes).reshape(1, 1, 1, 1)
}]

for proto, expected_output in zip(original, expected_outputs):
Expand Down
4 changes: 2 additions & 2 deletions tensorflow/python/kernel_tests/parsing_ops_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def testSerializedContainingDense(self):
bname: bytes_feature([b"b0_str"]),
})), example(features=features({
aname: float_feature([-1, -1]),
bname: bytes_feature([b"b1"]),
bname: bytes_feature([b""]),
}))
]

Expand All @@ -438,7 +438,7 @@ def testSerializedContainingDense(self):
[[1, 1], [-1, -1]], dtype=np.float32).reshape(2, 1, 2, 1),
bname:
np.array(
["b0_str", "b1"], dtype=bytes).reshape(2, 1, 1, 1, 1),
["b0_str", ""], dtype=bytes).reshape(2, 1, 1, 1, 1),
}

# No defaults, values required
Expand Down

0 comments on commit 6b8b9e4

Please sign in to comment.