def test_translate(self): for dtype in _DTYPES: with self.test_session(): image = constant_op.constant( [[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]], dtype=dtype) translation = constant_op.constant([-1, -1], dtypes.float32) image_translated = image_ops.translate(image, translation) self.assertAllEqual( image_translated.eval(), [[1, 0, 1, 0], [0, 1, 0, 0], [1, 0, 1, 0], [0, 0, 0, 0]])
def test_translate(self): for dtype in _DTYPES: with self.cached_session(): image = constant_op.constant( [[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]], dtype=dtype) translation = constant_op.constant([-1, -1], dtypes.float32) image_translated = image_ops.translate(image, translation) self.assertAllEqual(image_translated.eval(), [[1, 0, 1, 0], [0, 1, 0, 0], [1, 0, 1, 0], [0, 0, 0, 0]])