|
66 | 66 | quantize_and_dequantize = tf.quantization.quantize_and_dequantize
|
67 | 67 | resize_bilinear = tf.compat.v1.image.resize_bilinear
|
68 | 68 | resize_bilinear_v2 = tf.compat.v2.image.resize
|
| 69 | + resize_area = tf.compat.v1.image.resize_area |
69 | 70 | is_nan = tf.math.is_nan
|
70 | 71 | is_inf = tf.math.is_inf
|
71 | 72 | floormod = tf.math.floormod
|
|
84 | 85 | fused_batch_norm = tf.compat.v1.nn.fused_batch_norm
|
85 | 86 | dropout = tf.compat.v1.nn.dropout
|
86 | 87 | quantize_and_dequantize = tf.compat.v1.quantization.quantize_and_dequantize
|
| 88 | + resize_area = tf.compat.v1.image.resize_area |
87 | 89 | resize_nearest_neighbor = tf.compat.v1.image.resize_nearest_neighbor
|
88 | 90 | resize_bilinear = tf.compat.v1.image.resize_bilinear
|
89 | 91 | if Version(tf.__version__) >= Version("1.14"):
|
@@ -3285,6 +3287,31 @@ def func(x, x_new_size_):
|
3285 | 3287 | return tf.identity(x_, name=_TFOUTPUT)
|
3286 | 3288 | self._run_test_case(func, [_OUTPUT], {_INPUT: x_val, _INPUT1: x_new_size})
|
3287 | 3289 |
|
| 3290 | + @skip_caffe2_backend() |
| 3291 | + def test_resize_area(self): |
| 3292 | + x_shape = [1, 15, 20, 2] |
| 3293 | + x_new_size = [30, 40] |
| 3294 | + x_val = np.arange(1, 1 + np.prod(x_shape)).astype("float32").reshape(x_shape) |
| 3295 | + def func(x): |
| 3296 | + x_new_size_ = tf.constant(x_new_size) |
| 3297 | + x_ = resize_area(x, x_new_size_) |
| 3298 | + return tf.identity(x_, name=_TFOUTPUT) |
| 3299 | + _ = self._run_test_case(func, [_OUTPUT], {_INPUT: x_val}) |
| 3300 | + |
| 3301 | + # https://github.com/microsoft/onnxruntime/issues/17564 |
| 3302 | + @skip_onnxruntime_backend("Blocked by onnxruntime issue #17564") |
| 3303 | + @skip_caffe2_backend() |
| 3304 | + def test_resize_area_align_coreners(self): |
| 3305 | + x_shape = [1, 15, 20, 2] |
| 3306 | + x_new_size = [30, 40] |
| 3307 | + x_val = np.arange(1, 1 + np.prod(x_shape)).astype("float32").reshape(x_shape) |
| 3308 | + def func(x): |
| 3309 | + x_new_size_ = tf.constant(x_new_size) |
| 3310 | + x_ = resize_area(x, x_new_size_, align_corners=True) |
| 3311 | + return tf.identity(x_, name=_TFOUTPUT) |
| 3312 | + _ = self._run_test_case(func, [_OUTPUT], {_INPUT: x_val}) |
| 3313 | + |
| 3314 | + |
3288 | 3315 | @skip_caffe2_backend()
|
3289 | 3316 | @check_opset_min_version(7, "resize_bilinear")
|
3290 | 3317 | def test_resize_bilinear(self):
|
|
0 commit comments