forked from mindspore-Ecosystem/mindspore
!12630 make CPU op ResizeNearestNeighbor support float64 and Int64
From: @wanyiming Reviewed-by: Signed-off-by:
This commit is contained in:
commit
03935de4bf
|
@ -45,8 +45,12 @@ bool ResizeNearestNeighborCPUKernel::Launch(const std::vector<kernel::AddressPtr
|
|||
LaunchKernel<float16>(inputs, outputs);
|
||||
} else if (dtype_ == kNumberTypeFloat32) {
|
||||
LaunchKernel<float>(inputs, outputs);
|
||||
} else if (dtype_ == kNumberTypeFloat64) {
|
||||
LaunchKernel<double>(inputs, outputs);
|
||||
} else if (dtype_ == kNumberTypeInt32) {
|
||||
LaunchKernel<int32_t>(inputs, outputs);
|
||||
} else if (dtype_ == kNumberTypeInt64) {
|
||||
LaunchKernel<int64_t>(inputs, outputs);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -61,8 +61,15 @@ MS_REG_CPU_KERNEL(ResizeNearestNeighbor,
|
|||
KernelAttr().AddInputAttr(kNumberTypeFloat32).AddOutputAttr(kNumberTypeFloat32),
|
||||
ResizeNearestNeighborCPUKernel);
|
||||
|
||||
MS_REG_CPU_KERNEL(ResizeNearestNeighbor,
|
||||
KernelAttr().AddInputAttr(kNumberTypeFloat64).AddOutputAttr(kNumberTypeFloat64),
|
||||
ResizeNearestNeighborCPUKernel);
|
||||
|
||||
MS_REG_CPU_KERNEL(ResizeNearestNeighbor, KernelAttr().AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeInt32),
|
||||
ResizeNearestNeighborCPUKernel);
|
||||
|
||||
MS_REG_CPU_KERNEL(ResizeNearestNeighbor, KernelAttr().AddInputAttr(kNumberTypeInt64).AddOutputAttr(kNumberTypeInt64),
|
||||
ResizeNearestNeighborCPUKernel);
|
||||
} // namespace kernel
|
||||
} // namespace mindspore
|
||||
#endif // MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_CPU_RESIZE_NEAREST_NEIGHBOR_CPU_KERNEL_H_
|
||||
|
|
|
@ -44,8 +44,12 @@ bool ResizeNearestNeighborGradCPUKernel::Launch(const std::vector<kernel::Addres
|
|||
LaunchKernel<float16>(inputs, outputs);
|
||||
} else if (dtype_ == kNumberTypeFloat32) {
|
||||
LaunchKernel<float>(inputs, outputs);
|
||||
} else if (dtype_ == kNumberTypeFloat64) {
|
||||
LaunchKernel<double>(inputs, outputs);
|
||||
} else if (dtype_ == kNumberTypeInt32) {
|
||||
LaunchKernel<int32_t>(inputs, outputs);
|
||||
} else if (dtype_ == kNumberTypeInt64) {
|
||||
LaunchKernel<int64_t>(inputs, outputs);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -60,9 +60,17 @@ MS_REG_CPU_KERNEL(ResizeNearestNeighborGrad,
|
|||
KernelAttr().AddInputAttr(kNumberTypeFloat32).AddOutputAttr(kNumberTypeFloat32),
|
||||
ResizeNearestNeighborGradCPUKernel);
|
||||
|
||||
MS_REG_CPU_KERNEL(ResizeNearestNeighborGrad,
|
||||
KernelAttr().AddInputAttr(kNumberTypeFloat64).AddOutputAttr(kNumberTypeFloat64),
|
||||
ResizeNearestNeighborGradCPUKernel);
|
||||
|
||||
MS_REG_CPU_KERNEL(ResizeNearestNeighborGrad,
|
||||
KernelAttr().AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeInt32),
|
||||
ResizeNearestNeighborGradCPUKernel);
|
||||
|
||||
MS_REG_CPU_KERNEL(ResizeNearestNeighborGrad,
|
||||
KernelAttr().AddInputAttr(kNumberTypeInt64).AddOutputAttr(kNumberTypeInt64),
|
||||
ResizeNearestNeighborGradCPUKernel);
|
||||
} // namespace kernel
|
||||
} // namespace mindspore
|
||||
#endif // MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_CPU_RESIZE_NEAREST_NEIGHBOR_GRAD_CPU_KERNEL_H_
|
||||
|
|
|
@ -105,7 +105,6 @@ def resize_nn_grayscale_integer_ratio(datatype):
|
|||
output = resize_nn(input_tensor)
|
||||
np.testing.assert_array_equal(output.asnumpy(), input_tensor.asnumpy())
|
||||
|
||||
|
||||
def resize_nn_grayscale_not_integer_ratio(datatype):
|
||||
input_tensor = Tensor(np.array([[[[0.1, 0.2, 0.3, 0.4],
|
||||
[0.5, 0.6, 0.7, 0.8],
|
||||
|
@ -187,12 +186,11 @@ def resize_nn_grayscale_not_integer_ratio(datatype):
|
|||
output = resize_nn(input_tensor)
|
||||
np.testing.assert_array_equal(output.asnumpy(), input_tensor.asnumpy())
|
||||
|
||||
|
||||
def test_resize_nn_rgb_integer_ratio():
|
||||
def resize_nn_rgb_integer_ratio(datatype):
|
||||
input_tensor = Tensor(np.array(
|
||||
[[[[1, 2, 3], [4, 5, 6], [7, 8, 9]],
|
||||
[[11, 12, 13], [14, 15, 16], [17, 18, 19]],
|
||||
[[111, 112, 113], [114, 115, 116], [117, 118, 119]]]]).astype(np.int32))
|
||||
[[111, 112, 113], [114, 115, 116], [117, 118, 119]]]]).astype(datatype))
|
||||
|
||||
# larger h and w
|
||||
resize_nn = NetResizeNearestNeighbor((9, 9))
|
||||
|
@ -224,7 +222,7 @@ def test_resize_nn_rgb_integer_ratio():
|
|||
[117, 117, 117, 118, 118, 118, 119, 119, 119],
|
||||
[117, 117, 117, 118, 118, 118, 119, 119, 119],
|
||||
[117, 117, 117, 118, 118, 118, 119, 119, 119]]]])
|
||||
expected_output = Tensor(np.array(expected_output_array).astype(np.int32))
|
||||
expected_output = Tensor(np.array(expected_output_array).astype(datatype))
|
||||
|
||||
np.testing.assert_array_equal(expected_output.asnumpy(), output.asnumpy())
|
||||
|
||||
|
@ -232,7 +230,7 @@ def test_resize_nn_rgb_integer_ratio():
|
|||
resize_nn = NetResizeNearestNeighbor((1, 1))
|
||||
output = resize_nn(input_tensor)
|
||||
expected_output = Tensor(
|
||||
np.array([[[[1]], [[11]], [[111]]]]).astype(np.int32))
|
||||
np.array([[[[1]], [[11]], [[111]]]]).astype(datatype))
|
||||
np.testing.assert_array_equal(expected_output.asnumpy(), output.asnumpy())
|
||||
|
||||
# smaller h, larger w
|
||||
|
@ -240,7 +238,7 @@ def test_resize_nn_rgb_integer_ratio():
|
|||
output = resize_nn(input_tensor)
|
||||
expected_output = Tensor(np.array([[[[1, 1, 2, 2, 3, 3]],
|
||||
[[11, 11, 12, 12, 13, 13]],
|
||||
[[111, 111, 112, 112, 113, 113]]]]).astype(np.int32))
|
||||
[[111, 111, 112, 112, 113, 113]]]]).astype(datatype))
|
||||
np.testing.assert_array_equal(expected_output.asnumpy(), output.asnumpy())
|
||||
|
||||
# larger h, smaller w
|
||||
|
@ -248,7 +246,7 @@ def test_resize_nn_rgb_integer_ratio():
|
|||
output = resize_nn(input_tensor)
|
||||
expected_output = Tensor(np.array([[[[1], [1], [4], [4], [7], [7]],
|
||||
[[11], [11], [14], [14], [17], [17]],
|
||||
[[111], [111], [114], [114], [117], [117]]]]).astype(np.int32))
|
||||
[[111], [111], [114], [114], [117], [117]]]]).astype(datatype))
|
||||
np.testing.assert_array_equal(expected_output.asnumpy(), output.asnumpy())
|
||||
|
||||
# smaller h, same w
|
||||
|
@ -256,7 +254,7 @@ def test_resize_nn_rgb_integer_ratio():
|
|||
output = resize_nn(input_tensor)
|
||||
expected_output = Tensor(np.array([[[[1, 2, 3]],
|
||||
[[11, 12, 13]],
|
||||
[[111, 112, 113]]]]).astype(np.int32))
|
||||
[[111, 112, 113]]]]).astype(datatype))
|
||||
np.testing.assert_array_equal(expected_output.asnumpy(), output.asnumpy())
|
||||
|
||||
# larger h, same w
|
||||
|
@ -279,7 +277,7 @@ def test_resize_nn_rgb_integer_ratio():
|
|||
[114, 115, 116],
|
||||
[114, 115, 116],
|
||||
[117, 118, 119],
|
||||
[117, 118, 119]]]]).astype(np.int32))
|
||||
[117, 118, 119]]]]).astype(datatype))
|
||||
np.testing.assert_array_equal(expected_output.asnumpy(), output.asnumpy())
|
||||
|
||||
# same h, smaller w
|
||||
|
@ -287,7 +285,7 @@ def test_resize_nn_rgb_integer_ratio():
|
|||
output = resize_nn(input_tensor)
|
||||
expected_output = Tensor(np.array([[[[1], [4], [7]],
|
||||
[[11], [14], [17]],
|
||||
[[111], [114], [117]]]]).astype(np.int32))
|
||||
[[111], [114], [117]]]]).astype(datatype))
|
||||
np.testing.assert_array_equal(expected_output.asnumpy(), output.asnumpy())
|
||||
|
||||
# same h, larger w
|
||||
|
@ -301,7 +299,7 @@ def test_resize_nn_rgb_integer_ratio():
|
|||
[17, 17, 18, 18, 19, 19]],
|
||||
[[111, 111, 112, 112, 113, 113],
|
||||
[114, 114, 115, 115, 116, 116],
|
||||
[117, 117, 118, 118, 119, 119]]]]).astype(np.int32))
|
||||
[117, 117, 118, 118, 119, 119]]]]).astype(datatype))
|
||||
np.testing.assert_array_equal(expected_output.asnumpy(), output.asnumpy())
|
||||
|
||||
# same w, same h (identity)
|
||||
|
@ -309,8 +307,7 @@ def test_resize_nn_rgb_integer_ratio():
|
|||
output = resize_nn(input_tensor)
|
||||
np.testing.assert_array_equal(output.asnumpy(), input_tensor.asnumpy())
|
||||
|
||||
|
||||
def test_resize_nn_rgb_not_integer_ratio():
|
||||
def resize_nn_rgb_not_integer_ratio(datatype):
|
||||
input_tensor = Tensor(np.array([[[[1, 2, 3, 4],
|
||||
[5, 6, 7, 8],
|
||||
[9, 0, 1, 2]],
|
||||
|
@ -319,7 +316,7 @@ def test_resize_nn_rgb_not_integer_ratio():
|
|||
[19, 10, 11, 12]],
|
||||
[[111, 112, 113, 114],
|
||||
[115, 116, 117, 118],
|
||||
[119, 110, 111, 112]]]]).astype(np.int32))
|
||||
[119, 110, 111, 112]]]]).astype(datatype))
|
||||
|
||||
# larger h and w
|
||||
resize_nn = NetResizeNearestNeighbor((7, 7))
|
||||
|
@ -344,14 +341,14 @@ def test_resize_nn_rgb_not_integer_ratio():
|
|||
[115, 115, 116, 116, 117, 117, 118],
|
||||
[115, 115, 116, 116, 117, 117, 118],
|
||||
[119, 119, 110, 110, 111, 111, 112],
|
||||
[119, 119, 110, 110, 111, 111, 112]]]]).astype(np.int32))
|
||||
[119, 119, 110, 110, 111, 111, 112]]]]).astype(datatype))
|
||||
|
||||
# smaller h and w
|
||||
resize_nn = NetResizeNearestNeighbor((2, 3))
|
||||
output = resize_nn(input_tensor)
|
||||
expected_output = Tensor(np.array([[[[1, 2, 3], [5, 6, 7]],
|
||||
[[11, 12, 13], [15, 16, 17]],
|
||||
[[111, 112, 113], [115, 116, 117]]]]).astype(np.int32))
|
||||
[[111, 112, 113], [115, 116, 117]]]]).astype(datatype))
|
||||
np.testing.assert_array_equal(expected_output.asnumpy(), output.asnumpy())
|
||||
|
||||
# smaller h, larger w
|
||||
|
@ -362,7 +359,7 @@ def test_resize_nn_rgb_not_integer_ratio():
|
|||
[[11, 11, 12, 12, 13, 13, 14],
|
||||
[15, 15, 16, 16, 17, 17, 18]],
|
||||
[[111, 111, 112, 112, 113, 113, 114],
|
||||
[115, 115, 116, 116, 117, 117, 118]]]]).astype(np.int32))
|
||||
[115, 115, 116, 116, 117, 117, 118]]]]).astype(datatype))
|
||||
np.testing.assert_array_equal(expected_output.asnumpy(), output.asnumpy())
|
||||
|
||||
# larger h, smaller w
|
||||
|
@ -382,7 +379,7 @@ def test_resize_nn_rgb_not_integer_ratio():
|
|||
[111, 112, 113],
|
||||
[115, 116, 117],
|
||||
[115, 116, 117],
|
||||
[119, 110, 111]]]]).astype(np.int32))
|
||||
[119, 110, 111]]]]).astype(datatype))
|
||||
np.testing.assert_array_equal(expected_output.asnumpy(), output.asnumpy())
|
||||
|
||||
# smaller h, same w
|
||||
|
@ -393,7 +390,7 @@ def test_resize_nn_rgb_not_integer_ratio():
|
|||
[[11, 12, 13, 14],
|
||||
[15, 16, 17, 18]],
|
||||
[[111, 112, 113, 114],
|
||||
[115, 116, 117, 118]]]]).astype(np.int32))
|
||||
[115, 116, 117, 118]]]]).astype(datatype))
|
||||
np.testing.assert_array_equal(expected_output.asnumpy(), output.asnumpy())
|
||||
|
||||
# larger h, same w
|
||||
|
@ -422,7 +419,7 @@ def test_resize_nn_rgb_not_integer_ratio():
|
|||
[115, 116, 117, 118],
|
||||
[115, 116, 117, 118],
|
||||
[119, 110, 111, 112],
|
||||
[119, 110, 111, 112]]]]).astype(np.int32))
|
||||
[119, 110, 111, 112]]]]).astype(datatype))
|
||||
np.testing.assert_array_equal(expected_output.asnumpy(), output.asnumpy())
|
||||
|
||||
# same h, smaller w
|
||||
|
@ -430,7 +427,7 @@ def test_resize_nn_rgb_not_integer_ratio():
|
|||
output = resize_nn(input_tensor)
|
||||
expected_output = Tensor(np.array([[[[1, 3], [5, 7], [9, 1]],
|
||||
[[11, 13], [15, 17], [19, 11]],
|
||||
[[111, 113], [115, 117], [119, 111]]]]).astype(np.int32))
|
||||
[[111, 113], [115, 117], [119, 111]]]]).astype(datatype))
|
||||
np.testing.assert_array_equal(expected_output.asnumpy(), output.asnumpy())
|
||||
|
||||
# same h, larger w
|
||||
|
@ -444,7 +441,7 @@ def test_resize_nn_rgb_not_integer_ratio():
|
|||
[19, 19, 10, 11, 11, 12]],
|
||||
[[111, 111, 112, 113, 113, 114],
|
||||
[115, 115, 116, 117, 117, 118],
|
||||
[119, 119, 110, 111, 111, 112]]]]).astype(np.int32))
|
||||
[119, 119, 110, 111, 111, 112]]]]).astype(datatype))
|
||||
np.testing.assert_array_equal(expected_output.asnumpy(), output.asnumpy())
|
||||
|
||||
# same w, same h (identity)
|
||||
|
@ -452,6 +449,53 @@ def test_resize_nn_rgb_not_integer_ratio():
|
|||
output = resize_nn(input_tensor)
|
||||
np.testing.assert_array_equal(output.asnumpy(), input_tensor.asnumpy())
|
||||
|
||||
def resize_nn_rgb_multiple(datatype):
|
||||
input_tensor = Tensor(np.array([[[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]],
|
||||
[[11, 12, 13, 14, 15], [16, 17, 18, 19, 20]],
|
||||
[[111, 112, 113, 114, 115], [116, 117, 118, 119, 120]]],
|
||||
[[[11, 12, 13, 14, 15], [16, 17, 18, 19, 20]],
|
||||
[[111, 112, 113, 114, 115], [116, 117, 118, 119, 120]],
|
||||
[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]],
|
||||
[[[111, 112, 113, 114, 115], [116, 117, 118, 119, 120]],
|
||||
[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]],
|
||||
[[11, 12, 13, 14, 15], [16, 17, 18, 19, 20]]]]).astype(datatype))
|
||||
|
||||
resize_nn = NetResizeNearestNeighbor((5, 2))
|
||||
output = resize_nn(input_tensor)
|
||||
|
||||
expected_output = Tensor(np.array([[[[1, 3], [1, 3], [1, 3], [6, 8], [6, 8]],
|
||||
[[11, 13], [11, 13], [11, 13], [16, 18], [16, 18]],
|
||||
[[111, 113], [111, 113], [111, 113], [116, 118], [116, 118]]],
|
||||
[[[11, 13], [11, 13], [11, 13], [16, 18], [16, 18]],
|
||||
[[111, 113], [111, 113], [111, 113], [116, 118], [116, 118]],
|
||||
[[1, 3], [1, 3], [1, 3], [6, 8], [6, 8]]],
|
||||
[[[111, 113], [111, 113], [111, 113], [116, 118], [116, 118]],
|
||||
[[1, 3], [1, 3], [1, 3], [6, 8], [6, 8]],
|
||||
[[11, 13], [11, 13], [11, 13], [16, 18], [16, 18]]]]).astype(datatype))
|
||||
|
||||
np.testing.assert_array_equal(output.asnumpy(), expected_output.asnumpy())
|
||||
|
||||
def resize_nn_rgb_align_corners(datatype):
|
||||
input_tensor = Tensor(np.array([[[[1, 2, 3, 4], [5, 6, 7, 8]],
|
||||
[[11, 12, 13, 14], [15, 16, 17, 18]],
|
||||
[[21, 22, 23, 24], [25, 26, 27, 28]]]]).astype(datatype))
|
||||
|
||||
resize_nn_corners_aligned = NetResizeNearestNeighbor(
|
||||
(5, 2), align_corners=True)
|
||||
output_corners_aligned = resize_nn_corners_aligned(input_tensor)
|
||||
|
||||
resize_nn = NetResizeNearestNeighbor((5, 2))
|
||||
output = resize_nn(input_tensor)
|
||||
|
||||
expected_output = Tensor(np.array([[[[1, 4], [1, 4], [5, 8], [5, 8], [5, 8]],
|
||||
[[11, 14], [11, 14], [15, 18],
|
||||
[15, 18], [15, 18]],
|
||||
[[21, 24], [21, 24], [25, 28], [25, 28], [25, 28]]]]).astype(datatype))
|
||||
|
||||
np.testing.assert_array_equal(
|
||||
output_corners_aligned.asnumpy(), expected_output.asnumpy())
|
||||
np.testing.assert_raises(AssertionError, np.testing.assert_array_equal,
|
||||
output.asnumpy(), expected_output.asnumpy())
|
||||
|
||||
def resize_nn_grayscale_multiple_images(datatype):
|
||||
input_tensor = Tensor(np.array([[[[0.1, 0.2, 0.3], [0.4, 0.5, 0.6], [0.7, 0.8, 0.9]]],
|
||||
|
@ -470,7 +514,6 @@ def resize_nn_grayscale_multiple_images(datatype):
|
|||
|
||||
np.testing.assert_array_equal(output.asnumpy(), expected_output.asnumpy())
|
||||
|
||||
|
||||
def resize_nn_grayscale_align_corners(datatype):
|
||||
input_tensor = Tensor(
|
||||
np.array([[[[0.1, 0.2, 0.3, 0.4], [0.5, 0.6, 0.7, 0.8]]]]).astype(datatype))
|
||||
|
@ -491,99 +534,84 @@ def resize_nn_grayscale_align_corners(datatype):
|
|||
np.testing.assert_raises(AssertionError, np.testing.assert_array_equal,
|
||||
output.asnumpy(), expected_output.asnumpy())
|
||||
|
||||
|
||||
def test_resize_nn_rgb_multiple():
|
||||
input_tensor = Tensor(np.array([[[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]],
|
||||
[[11, 12, 13, 14, 15], [16, 17, 18, 19, 20]],
|
||||
[[111, 112, 113, 114, 115], [116, 117, 118, 119, 120]]],
|
||||
[[[11, 12, 13, 14, 15], [16, 17, 18, 19, 20]],
|
||||
[[111, 112, 113, 114, 115], [116, 117, 118, 119, 120]],
|
||||
[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]],
|
||||
[[[111, 112, 113, 114, 115], [116, 117, 118, 119, 120]],
|
||||
[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]],
|
||||
[[11, 12, 13, 14, 15], [16, 17, 18, 19, 20]]]]).astype(np.int32))
|
||||
|
||||
resize_nn = NetResizeNearestNeighbor((5, 2))
|
||||
output = resize_nn(input_tensor)
|
||||
|
||||
expected_output = Tensor(np.array([[[[1, 3], [1, 3], [1, 3], [6, 8], [6, 8]],
|
||||
[[11, 13], [11, 13], [11, 13], [16, 18], [16, 18]],
|
||||
[[111, 113], [111, 113], [111, 113], [116, 118], [116, 118]]],
|
||||
[[[11, 13], [11, 13], [11, 13], [16, 18], [16, 18]],
|
||||
[[111, 113], [111, 113], [111, 113], [116, 118], [116, 118]],
|
||||
[[1, 3], [1, 3], [1, 3], [6, 8], [6, 8]]],
|
||||
[[[111, 113], [111, 113], [111, 113], [116, 118], [116, 118]],
|
||||
[[1, 3], [1, 3], [1, 3], [6, 8], [6, 8]],
|
||||
[[11, 13], [11, 13], [11, 13], [16, 18], [16, 18]]]]).astype(np.int32))
|
||||
|
||||
np.testing.assert_array_equal(output.asnumpy(), expected_output.asnumpy())
|
||||
|
||||
|
||||
def test_resize_nn_rgb_align_corners():
|
||||
input_tensor = Tensor(np.array([[[[1, 2, 3, 4], [5, 6, 7, 8]],
|
||||
[[11, 12, 13, 14], [15, 16, 17, 18]],
|
||||
[[21, 22, 23, 24], [25, 26, 27, 28]]]]).astype(np.int32))
|
||||
|
||||
resize_nn_corners_aligned = NetResizeNearestNeighbor(
|
||||
(5, 2), align_corners=True)
|
||||
output_corners_aligned = resize_nn_corners_aligned(input_tensor)
|
||||
|
||||
resize_nn = NetResizeNearestNeighbor((5, 2))
|
||||
output = resize_nn(input_tensor)
|
||||
|
||||
expected_output = Tensor(np.array([[[[1, 4], [1, 4], [5, 8], [5, 8], [5, 8]],
|
||||
[[11, 14], [11, 14], [15, 18],
|
||||
[15, 18], [15, 18]],
|
||||
[[21, 24], [21, 24], [25, 28], [25, 28], [25, 28]]]]).astype(np.int32))
|
||||
|
||||
np.testing.assert_array_equal(
|
||||
output_corners_aligned.asnumpy(), expected_output.asnumpy())
|
||||
np.testing.assert_raises(AssertionError, np.testing.assert_array_equal,
|
||||
output.asnumpy(), expected_output.asnumpy())
|
||||
|
||||
|
||||
def test_resize_nn_grayscale_integer_ratio_half():
|
||||
resize_nn_grayscale_integer_ratio(np.float16)
|
||||
|
||||
|
||||
def test_resize_nn_grayscale_integer_ratio_float():
|
||||
resize_nn_grayscale_integer_ratio(np.float32)
|
||||
|
||||
def test_resize_nn_grayscale_integer_ratio_double():
|
||||
resize_nn_grayscale_integer_ratio(np.float64)
|
||||
|
||||
def test_resize_nn_grayscale_not_integer_ratio_half():
|
||||
resize_nn_grayscale_not_integer_ratio(np.float16)
|
||||
|
||||
|
||||
def test_resize_nn_grayscale_not_integer_ratio_float():
|
||||
resize_nn_grayscale_not_integer_ratio(np.float32)
|
||||
|
||||
def test_resize_nn_grayscale_not_integer_ratio_double():
|
||||
resize_nn_grayscale_not_integer_ratio(np.float64)
|
||||
|
||||
def test_resize_nn_grayscale_multiple_half():
|
||||
resize_nn_grayscale_multiple_images(np.float16)
|
||||
|
||||
|
||||
def test_resize_nn_grayscale_multiple_float():
|
||||
resize_nn_grayscale_multiple_images(np.float32)
|
||||
|
||||
def test_resize_nn_grayscale_multiple_double():
|
||||
resize_nn_grayscale_multiple_images(np.float64)
|
||||
|
||||
def test_resize_nn_grayscale_align_corners_half():
|
||||
resize_nn_grayscale_align_corners(np.float16)
|
||||
|
||||
|
||||
def test_resize_nn_grayscale_align_corners_float():
|
||||
resize_nn_grayscale_align_corners(np.float32)
|
||||
|
||||
def test_resize_nn_grayscale_align_corners_double():
|
||||
resize_nn_grayscale_align_corners(np.float64)
|
||||
|
||||
def test_resize_nn_rgb_integer_ratio_int32():
|
||||
resize_nn_rgb_integer_ratio(np.int32)
|
||||
|
||||
def test_resize_nn_rgb_integer_ratio_int64():
|
||||
resize_nn_rgb_integer_ratio(np.int64)
|
||||
|
||||
def test_resize_nn_rgb_not_integer_ratio_int32():
|
||||
resize_nn_rgb_not_integer_ratio(np.int32)
|
||||
|
||||
def test_resize_nn_rgb_not_integer_ratio_int64():
|
||||
resize_nn_rgb_not_integer_ratio(np.int64)
|
||||
|
||||
def test_resize_nn_rgb_multiple_int32():
|
||||
resize_nn_rgb_multiple(np.int32)
|
||||
|
||||
def test_resize_nn_rgb_multiple_int64():
|
||||
resize_nn_rgb_multiple(np.int64)
|
||||
|
||||
def test_resize_nn_rgb_align_corners_int32():
|
||||
resize_nn_rgb_align_corners(np.int32)
|
||||
|
||||
def test_resize_nn_rgb_align_corners_int64():
|
||||
resize_nn_rgb_align_corners(np.int64)
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_resize_nn_grayscale_integer_ratio_half()
|
||||
test_resize_nn_grayscale_integer_ratio_float()
|
||||
test_resize_nn_grayscale_integer_ratio_double()
|
||||
test_resize_nn_grayscale_not_integer_ratio_half()
|
||||
test_resize_nn_grayscale_not_integer_ratio_float()
|
||||
test_resize_nn_grayscale_not_integer_ratio_double()
|
||||
test_resize_nn_grayscale_multiple_half()
|
||||
test_resize_nn_grayscale_multiple_float()
|
||||
test_resize_nn_grayscale_multiple_double()
|
||||
test_resize_nn_grayscale_align_corners_half()
|
||||
test_resize_nn_grayscale_align_corners_float()
|
||||
test_resize_nn_rgb_integer_ratio()
|
||||
test_resize_nn_rgb_not_integer_ratio()
|
||||
test_resize_nn_rgb_multiple()
|
||||
test_resize_nn_rgb_align_corners()
|
||||
test_resize_nn_grayscale_align_corners_double()
|
||||
test_resize_nn_rgb_integer_ratio_int32()
|
||||
test_resize_nn_rgb_integer_ratio_int64()
|
||||
test_resize_nn_rgb_not_integer_ratio_int32()
|
||||
test_resize_nn_rgb_not_integer_ratio_int64()
|
||||
test_resize_nn_rgb_multiple_int32()
|
||||
test_resize_nn_rgb_multiple_int64()
|
||||
test_resize_nn_rgb_align_corners_int32()
|
||||
test_resize_nn_rgb_align_corners_int64()
|
||||
|
|
Loading…
Reference in New Issue