Add test case for additional arg with extract_glimpse

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang 2018-03-13 17:58:03 +00:00
parent 2c409af18d
commit a8105c7d2a

View File

@ -21,6 +21,7 @@ from __future__ import print_function
import numpy as np import numpy as np
from tensorflow.python.framework import constant_op from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.ops import array_ops from tensorflow.python.ops import array_ops
from tensorflow.python.ops import image_ops from tensorflow.python.ops import image_ops
from tensorflow.python.platform import test from tensorflow.python.platform import test
@ -195,5 +196,15 @@ class ExtractGlimpseTest(test.TestCase):
expected_rows=[None, None, None, 1, 2, 3, 4], expected_rows=[None, None, None, 1, 2, 3, 4],
expected_cols=[56, 57, 58, 59, 60]) expected_cols=[56, 57, 58, 59, 60])
def testGlimpseNoOverlapZero(self):
img = constant_op.constant(np.arange(25).reshape((1, 5, 5, 1)),
dtype=dtypes.float32)
with self.test_session():
result = image_ops.extract_glimpse(img, [3, 3], [[-2, 2]],
centered=False, normalized=False,
uniform_noise=False, noise="zero")
self.assertAllEqual(np.asarray([[0, 0, 0], [0, 0, 0], [0, 0, 0]]),
result.eval()[0, :, :, 0])
if __name__ == '__main__': if __name__ == '__main__':
test.main() test.main()