Merge pull request #42324 from aavishkarmishra:patch-2

PiperOrigin-RevId: 335972322
Change-Id: Ic97615d6a536a8eeabde701e24e06ba4c0bff53d
This commit is contained in:
TensorFlower Gardener 2020-10-07 16:15:58 -07:00
commit 7e392a3eb4

View File

@ -5402,6 +5402,19 @@ def fractional_max_pool_v2(value,
[Graham, 2015](https://arxiv.org/abs/1412.6071)
([pdf](https://arxiv.org/pdf/1412.6071.pdf))
"""
if (isinstance(pooling_ratio, (list, tuple))):
if (pooling_ratio[0] != 1.0 or pooling_ratio[-1] != 1.0):
raise ValueError(
"The first and last elements of pooling ratio must be 1.0.")
for element in pooling_ratio:
if element < 1.0:
raise ValueError("pooling_ratio should be >= 1.0.")
elif (isinstance(pooling_ratio, (int, float))):
if pooling_ratio < 1.0:
raise ValueError("pooling_ratio should be >= 1.0.")
else:
raise ValueError("pooling_ratio should be an int or a list of ints.")
pooling_ratio = _get_sequence(pooling_ratio, 2, 3, "pooling_ratio")
if seed == 0:
@ -5603,7 +5616,6 @@ def erosion2d(value, kernel, strides, rates, padding, name=None):
Returns:
A `Tensor`. Has the same type as `value`.
4-D with shape `[batch, out_height, out_width, depth]`.
Raises:
ValueError: If the `value` depth does not match `kernel`' shape, or if
padding is other than `'VALID'` or `'SAME'`.