aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/receptive_field
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-09-01 12:07:05 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-09-01 12:10:49 -0700
commit9fe71e08a56035dd547f7f9e9f7fdc0b093d0c96 (patch)
treec94b34916415b41ac938e23df2114e8af06de805 /tensorflow/contrib/receptive_field
parent046533f852bd7d8bffd1a0f19cc1991cdedfc92b (diff)
Adding back contrib.receptive_field test to oss.
PiperOrigin-RevId: 167307311
Diffstat (limited to 'tensorflow/contrib/receptive_field')
-rw-r--r--tensorflow/contrib/receptive_field/BUILD3
-rw-r--r--tensorflow/contrib/receptive_field/README.md3
-rw-r--r--tensorflow/contrib/receptive_field/python/util/receptive_field.py10
3 files changed, 9 insertions, 7 deletions
diff --git a/tensorflow/contrib/receptive_field/BUILD b/tensorflow/contrib/receptive_field/BUILD
index e2d7c07510..ed2f3af08c 100644
--- a/tensorflow/contrib/receptive_field/BUILD
+++ b/tensorflow/contrib/receptive_field/BUILD
@@ -47,9 +47,6 @@ py_test(
name = "receptive_field_test",
srcs = ["python/util/receptive_field_test.py"],
srcs_version = "PY2AND3",
- tags = [
- "no_oss", # see b/65254194
- ],
deps = [
":receptive_field_py",
"//tensorflow/contrib/framework:framework_py",
diff --git a/tensorflow/contrib/receptive_field/README.md b/tensorflow/contrib/receptive_field/README.md
index f7539ec145..b150b903b2 100644
--- a/tensorflow/contrib/receptive_field/README.md
+++ b/tensorflow/contrib/receptive_field/README.md
@@ -161,4 +161,5 @@ Effective padding (vertical) = 1482
## Authors
-Andr&eacute; Araujo (andrefaraujo@) and Mark Sandler
+Andr&eacute; Araujo (github id: andrefaraujo) and Mark Sandler (github id:
+marksandler)
diff --git a/tensorflow/contrib/receptive_field/python/util/receptive_field.py b/tensorflow/contrib/receptive_field/python/util/receptive_field.py
index 4e723829bf..db190a1a41 100644
--- a/tensorflow/contrib/receptive_field/python/util/receptive_field.py
+++ b/tensorflow/contrib/receptive_field/python/util/receptive_field.py
@@ -35,6 +35,10 @@ _UNCHANGED_RF_LAYER_OPS = [
"VariableV2", "Sub", "Rsqrt", "ConcatV2"
]
+# Different ways in which padding modes may be spelled.
+_VALID_PADDING = ["VALID", b"VALID"]
+_SAME_PADDING = ["SAME", b"SAME"]
+
def _stride_size(node):
"""Computes stride size given a TF node.
@@ -102,9 +106,9 @@ def _padding_size_conv_pool(node, kernel_size, stride):
# depends on input size, we raise an exception.
padding_attr = node.attr["padding"]
logging.vlog(4, "padding_attr = %s", padding_attr)
- if padding_attr.s == "VALID":
+ if padding_attr.s in _VALID_PADDING:
padding = 0
- elif padding_attr.s == "SAME":
+ elif padding_attr.s in _SAME_PADDING:
if kernel_size == 1:
padding = 0
elif stride == 1:
@@ -118,7 +122,7 @@ def _padding_size_conv_pool(node, kernel_size, stride):
"padding may be different depending on the input image "
"dimensionality. In this case, alignment check will be skipped.")
else:
- raise ValueError("Invalid padding operation")
+ raise ValueError("Invalid padding operation %s" % padding_attr.s)
return padding