Skip to content

Commit

Permalink
Add rule to add data_format arg to dilation2d.
Browse files Browse the repository at this point in the history
This is the missing part of #30277.

This will make the converter script produce invalid code (until #30277 is in), but it's no worse than today at least.

PiperOrigin-RevId: 261195994
  • Loading branch information
martinwicke authored and tensorflower-gardener committed Aug 1, 2019
1 parent 9e4d040 commit c38d739
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tensorflow/tools/compatibility/tf_upgrade_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1526,6 +1526,10 @@ def __init__(self):
"'merge_repeated' argument and behaves as if merge_repeated=False. "
"This call site specifies something other than "
"merge_repeated=False, so it was converted to compat.v1."),
"tf.nn.dilation2d": functools.partial(
_add_argument_transformer,
arg_name="data_format",
arg_value_ast=ast.Str("NHWC")),
"tf.nn.erosion2d": functools.partial(
_add_argument_transformer,
arg_name="data_format",
Expand Down
6 changes: 6 additions & 0 deletions tensorflow/tools/compatibility/tf_upgrade_v2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2069,6 +2069,12 @@ def testNnErosion2d(self):
_, _, _, new_text = self._upgrade(text)
self.assertEqual(new_text, expected_text)

def testNnDilation2d(self):
text = "tf.nn.dilation2d(v, k, s, r, p)"
expected_text = "tf.nn.dilation2d(v, k, s, r, p, data_format='NHWC')"
_, _, _, new_text = self._upgrade(text)
self.assertEqual(new_text, expected_text)

def testPywrapTensorflowWarning(self):
text = "tf.pywrap_tensorflow.foo()"
expected = "tf.pywrap_tensorflow.foo()"
Expand Down

0 comments on commit c38d739

Please sign in to comment.