[Interpolate-11] Additional tests for Interpolate-11 reference implementation (#16956)
* bf precision tests * i32 prec tests * Default axes test * Add f16 prec tests * i8 prec tests * Update eval types in the new file
This commit is contained in:
parent
9ca85eb363
commit
834e611bde
@ -227,27 +227,24 @@ static void pad_input_data(const uint8_t* data_ptr,
|
||||
}
|
||||
|
||||
namespace v11 {
|
||||
bool evaluate_interpolate(const std::shared_ptr<ngraph::op::v11::Interpolate>& op,
|
||||
bool evaluate_interpolate(const std::shared_ptr<ov::op::v11::Interpolate>& op,
|
||||
const ngraph::HostTensorVector& outputs,
|
||||
const ngraph::HostTensorVector& inputs) {
|
||||
using namespace ov::op;
|
||||
using namespace ov;
|
||||
|
||||
constexpr size_t data_port = 0;
|
||||
constexpr size_t scales_sizes_port = 1;
|
||||
constexpr size_t axes_port = 2;
|
||||
constexpr size_t max_num_of_ports = 3;
|
||||
|
||||
ngraph::element::Type input_et = inputs[0]->get_element_type();
|
||||
element::Type input_et = inputs[0]->get_element_type();
|
||||
size_t type_size = input_et.size();
|
||||
|
||||
ov::PartialShape input_shape{inputs[data_port]->get_shape()};
|
||||
PartialShape input_shape{inputs[data_port]->get_shape()};
|
||||
auto m_attrs = op->get_attrs();
|
||||
util::correct_pads_attr(op.get(),
|
||||
m_attrs.pads_begin,
|
||||
m_attrs.pads_end,
|
||||
std::vector<ngraph::PartialShape>{input_shape});
|
||||
op::util::correct_pads_attr(op.get(), m_attrs.pads_begin, m_attrs.pads_end, std::vector<PartialShape>{input_shape});
|
||||
|
||||
ov::Shape padded_input_shape;
|
||||
Shape padded_input_shape;
|
||||
for (size_t i = 0; i < input_shape.size(); ++i) {
|
||||
padded_input_shape.emplace_back(m_attrs.pads_begin[i] + m_attrs.pads_end[i] + input_shape[i].get_length());
|
||||
}
|
||||
@ -255,17 +252,17 @@ bool evaluate_interpolate(const std::shared_ptr<ngraph::op::v11::Interpolate>& o
|
||||
auto axes = get_axes_vector(inputs, inputs[1]->get_shape()[0], axes_port, max_num_of_ports);
|
||||
auto scales = get_scales_vector(inputs, padded_input_shape, m_attrs, axes, scales_sizes_port);
|
||||
|
||||
ov::PartialShape output_shape{padded_input_shape};
|
||||
if (m_attrs.shape_calculation_mode == util::InterpolateBase::ShapeCalcMode::SCALES) {
|
||||
util::infer_using_scales(output_shape, axes, scales);
|
||||
PartialShape output_shape{padded_input_shape};
|
||||
if (m_attrs.shape_calculation_mode == op::util::InterpolateBase::ShapeCalcMode::SCALES) {
|
||||
op::util::infer_using_scales(output_shape, axes, scales);
|
||||
} else {
|
||||
auto sizes = get_target_shape_vector(inputs, axes.size(), scales_sizes_port);
|
||||
for (size_t i = 0; i < sizes.size(); ++i) {
|
||||
output_shape[axes[i]] = ngraph::Dimension(sizes[i]);
|
||||
output_shape[axes[i]] = Dimension(sizes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
ov::Shape out_shape = output_shape.to_shape();
|
||||
Shape out_shape = output_shape.to_shape();
|
||||
outputs[0]->set_shape(out_shape);
|
||||
outputs[0]->set_element_type(input_et);
|
||||
|
||||
@ -283,7 +280,7 @@ bool evaluate_interpolate(const std::shared_ptr<ngraph::op::v11::Interpolate>& o
|
||||
m_attrs.pads_begin);
|
||||
|
||||
switch (input_et) {
|
||||
case ngraph::element::Type_t::f32:
|
||||
case element::Type_t::f32:
|
||||
ngraph::runtime::reference::interpolate<float>(reinterpret_cast<float*>(padded_data_ptr),
|
||||
padded_input_shape,
|
||||
scales,
|
||||
@ -292,7 +289,25 @@ bool evaluate_interpolate(const std::shared_ptr<ngraph::op::v11::Interpolate>& o
|
||||
out_shape,
|
||||
m_attrs);
|
||||
break;
|
||||
case ngraph::element::Type_t::u8:
|
||||
case element::Type_t::bf16:
|
||||
ngraph::runtime::reference::interpolate<bfloat16>(reinterpret_cast<bfloat16*>(padded_data_ptr),
|
||||
padded_input_shape,
|
||||
scales,
|
||||
axes,
|
||||
outputs[0]->get_data_ptr<bfloat16>(),
|
||||
out_shape,
|
||||
m_attrs);
|
||||
break;
|
||||
case element::Type_t::f16:
|
||||
ngraph::runtime::reference::interpolate<float16>(reinterpret_cast<float16*>(padded_data_ptr),
|
||||
padded_input_shape,
|
||||
scales,
|
||||
axes,
|
||||
outputs[0]->get_data_ptr<float16>(),
|
||||
out_shape,
|
||||
m_attrs);
|
||||
break;
|
||||
case element::Type_t::u8:
|
||||
ngraph::runtime::reference::interpolate<uint8_t>(reinterpret_cast<uint8_t*>(padded_data_ptr),
|
||||
padded_input_shape,
|
||||
scales,
|
||||
@ -301,6 +316,24 @@ bool evaluate_interpolate(const std::shared_ptr<ngraph::op::v11::Interpolate>& o
|
||||
out_shape,
|
||||
m_attrs);
|
||||
break;
|
||||
case element::Type_t::i8:
|
||||
ngraph::runtime::reference::interpolate<int8_t>(reinterpret_cast<int8_t*>(padded_data_ptr),
|
||||
padded_input_shape,
|
||||
scales,
|
||||
axes,
|
||||
outputs[0]->get_data_ptr<int8_t>(),
|
||||
out_shape,
|
||||
m_attrs);
|
||||
break;
|
||||
case element::Type_t::i32:
|
||||
ngraph::runtime::reference::interpolate<int32_t>(reinterpret_cast<int32_t*>(padded_data_ptr),
|
||||
padded_input_shape,
|
||||
scales,
|
||||
axes,
|
||||
outputs[0]->get_data_ptr<int32_t>(),
|
||||
out_shape,
|
||||
m_attrs);
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
|
||||
@ -394,4 +427,4 @@ bool evaluate_node<ngraph::op::v11::Interpolate>(std::shared_ptr<ngraph::Node> n
|
||||
throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() +
|
||||
std::string("in evaluate_node()"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -855,7 +855,7 @@ public:
|
||||
};
|
||||
|
||||
template <typename Data_t = uint8_t>
|
||||
std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bilinear_pil_int() {
|
||||
std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bilinear_pil_int_common() {
|
||||
const std::vector<size_t> zero_pads{0, 0, 0, 0};
|
||||
return {
|
||||
{
|
||||
@ -993,8 +993,38 @@ std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bilinear_pil_
|
||||
}};
|
||||
}
|
||||
|
||||
template <typename Data_t = int8_t>
|
||||
std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bilinear_pil_int8() {
|
||||
return {
|
||||
{
|
||||
"bilinear.downsample_range_2D_sizes",
|
||||
Shape{8, 8},
|
||||
{4, 4},
|
||||
Shape{4, 4},
|
||||
{},
|
||||
{0, 1},
|
||||
{InterpolateMode::BILINEAR_PILLOW, ShapeCalcMode::SIZES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||||
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
|
||||
44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63},
|
||||
std::vector<Data_t>{7, 9, 11, 12, 21, 23, 25, 26, 37, 39, 41, 42, 51, 53, 55, 56},
|
||||
},
|
||||
{
|
||||
"bilinear.upsample_range_2D_scales",
|
||||
Shape{4, 4},
|
||||
{},
|
||||
Shape{8, 8},
|
||||
{2.0f, 2.0f},
|
||||
{0, 1},
|
||||
{InterpolateMode::BILINEAR_PILLOW, ShapeCalcMode::SCALES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{7, 9, 11, 12, 21, 23, 25, 26, 37, 39, 41, 42, 51, 53, 55, 56},
|
||||
std::vector<Data_t>{7, 8, 9, 10, 11, 11, 12, 12, 11, 12, 13, 14, 15, 15, 16, 16, 18, 19, 20, 21, 22, 22,
|
||||
23, 23, 25, 26, 27, 28, 29, 29, 30, 30, 33, 34, 35, 36, 37, 37, 38, 38, 41, 42, 43, 44,
|
||||
45, 45, 46, 46, 48, 49, 50, 51, 52, 52, 53, 53, 51, 52, 53, 54, 55, 55, 56, 56},
|
||||
}};
|
||||
}
|
||||
template <typename Data_t = uint8_t>
|
||||
std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bicubic_pil_int() {
|
||||
std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bicubic_pil_int_common() {
|
||||
return {
|
||||
{
|
||||
"bicubic.downsample_scales_2D",
|
||||
@ -1037,6 +1067,22 @@ std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bicubic_pil_i
|
||||
std::vector<Data_t>{99, 143, 105, 88, 146, 98, 123, 154},
|
||||
-0.5, // cube_coeff
|
||||
},
|
||||
{
|
||||
"bicubic.upsample_sizes_2D",
|
||||
Shape{4, 4},
|
||||
{8, 8},
|
||||
Shape{8, 8},
|
||||
{},
|
||||
{0, 1},
|
||||
{InterpolateMode::BICUBIC_PILLOW, ShapeCalcMode::SIZES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{5, 6, 9, 10, 21, 22, 25, 26, 37, 38, 41, 42, 53, 54, 57, 58},
|
||||
std::vector<Data_t>{
|
||||
4, 4, 5, 6, 7, 8, 9, 9, 8, 8, 9, 10, 11, 12, 13, 13, 16, 16, 17, 18, 19, 20,
|
||||
21, 21, 25, 25, 26, 27, 28, 29, 30, 30, 33, 33, 34, 35, 36, 37, 38, 38, 42, 42, 43, 44,
|
||||
45, 46, 47, 47, 50, 50, 51, 52, 53, 54, 55, 55, 54, 54, 55, 56, 57, 58, 59, 59,
|
||||
},
|
||||
-0.5, // cube_coeff
|
||||
},
|
||||
{
|
||||
"bicubic.downsample_sizes_2D_ov_default_cube_coeff",
|
||||
Shape{5, 6},
|
||||
@ -1078,23 +1124,6 @@ std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bicubic_pil_i
|
||||
std::vector<Data_t>{5, 6, 9, 10, 21, 22, 25, 26, 37, 38, 41, 42, 53, 54, 57, 58},
|
||||
-0.5, // cube_coeff
|
||||
},
|
||||
{
|
||||
"bicubic.upsample_sizes_1x2x4x3_to_1x5x6x3_nhwc",
|
||||
Shape{1, 2, 4, 3},
|
||||
{5, 6},
|
||||
Shape{1, 5, 6, 3},
|
||||
{},
|
||||
{1, 2},
|
||||
{InterpolateMode::BICUBIC_PILLOW, ShapeCalcMode::SIZES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{168, 92, 157, 111, 15, 138, 97, 47, 237, 25, 163, 6,
|
||||
72, 118, 121, 238, 22, 174, 182, 140, 43, 121, 158, 242},
|
||||
std::vector<Data_t>{183, 94, 162, 141, 53, 141, 94, 11, 150, 93, 27, 255, 49, 105, 119, 10, 172, 0,
|
||||
165, 99, 155, 143, 55, 143, 116, 14, 152, 108, 42, 226, 64, 113, 122, 26, 170, 17,
|
||||
117, 111, 138, 148, 60, 148, 175, 22, 155, 148, 80, 143, 102, 133, 131, 69, 165, 128,
|
||||
68, 122, 121, 152, 65, 153, 233, 29, 158, 188, 118, 60, 140, 153, 140, 111, 160, 238,
|
||||
50, 127, 114, 154, 67, 155, 255, 32, 160, 203, 133, 29, 155, 161, 143, 127, 158, 255},
|
||||
-0.5, // cube_coeff
|
||||
},
|
||||
{
|
||||
"bicubic.downsample_sizes_1x5x6x3_to_1x2x4x3_nhwc",
|
||||
Shape{1, 5, 6, 3},
|
||||
@ -1115,6 +1144,97 @@ std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bicubic_pil_i
|
||||
}};
|
||||
}
|
||||
|
||||
template <typename Data_t = int8_t>
|
||||
std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bicubic_pil_int8() {
|
||||
return {
|
||||
{
|
||||
"bicubic.downsample_scales_2D",
|
||||
Shape{8, 8},
|
||||
{},
|
||||
Shape{4, 4},
|
||||
{0.5f, 0.5f},
|
||||
{0, 1},
|
||||
{InterpolateMode::BICUBIC_PILLOW, ShapeCalcMode::SCALES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||||
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
|
||||
44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63},
|
||||
std::vector<Data_t>{5, 6, 9, 10, 21, 22, 25, 26, 37, 38, 41, 42, 53, 54, 57, 58},
|
||||
-0.5, // cube_coeff
|
||||
},
|
||||
{
|
||||
"bicubic.upsample_sizes_2D",
|
||||
Shape{4, 4},
|
||||
{8, 8},
|
||||
Shape{8, 8},
|
||||
{},
|
||||
{0, 1},
|
||||
{InterpolateMode::BICUBIC_PILLOW, ShapeCalcMode::SIZES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{5, 6, 9, 10, 21, 22, 25, 26, 37, 38, 41, 42, 53, 54, 57, 58},
|
||||
std::vector<Data_t>{
|
||||
4, 4, 5, 6, 7, 8, 9, 9, 8, 8, 9, 10, 11, 12, 13, 13, 16, 16, 17, 18, 19, 20,
|
||||
21, 21, 25, 25, 26, 27, 28, 29, 30, 30, 33, 33, 34, 35, 36, 37, 38, 38, 42, 42, 43, 44,
|
||||
45, 46, 47, 47, 50, 50, 51, 52, 53, 54, 55, 55, 54, 54, 55, 56, 57, 58, 59, 59,
|
||||
},
|
||||
-0.5, // cube_coeff
|
||||
}};
|
||||
}
|
||||
|
||||
template <typename Data_t = uint8_t>
|
||||
std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bicubic_pil_uint8() {
|
||||
return {{
|
||||
"bicubic.upsample_sizes_1x2x4x3_to_1x5x6x3_nhwc",
|
||||
Shape{1, 2, 4, 3},
|
||||
{5, 6},
|
||||
Shape{1, 5, 6, 3},
|
||||
{},
|
||||
{1, 2},
|
||||
{InterpolateMode::BICUBIC_PILLOW, ShapeCalcMode::SIZES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{168, 92, 157, 111, 15, 138, 97, 47, 237, 25, 163, 6,
|
||||
72, 118, 121, 238, 22, 174, 182, 140, 43, 121, 158, 242},
|
||||
std::vector<Data_t>{
|
||||
183, 94, 162, 141, 53, 141, 94, 11, 150,
|
||||
93, 27, 255, 49, 105, 119, 10, 172, 0 /* -3 without clip */,
|
||||
165, 99, 155, 143, 55, 143, 116, 14, 152,
|
||||
108, 42, 226, 64, 113, 122, 26, 170, 17,
|
||||
117, 111, 138, 148, 60, 148, 175, 22, 155,
|
||||
148, 80, 143, 102, 133, 131, 69, 165, 128,
|
||||
68, 122, 121, 152, 65, 153, 233, 29, 158,
|
||||
188, 118, 60, 140, 153, 140, 111, 160, 238,
|
||||
50, 127, 114, 154, 67, 155, 255, 32, 160,
|
||||
203, 133, 29, 155, 161, 143, 127, 158, 255 /* 281 without clip */
|
||||
},
|
||||
-0.5, // cube_coeff
|
||||
}};
|
||||
}
|
||||
|
||||
template <typename Data_t = int32_t>
|
||||
std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bicubic_pil_int32() {
|
||||
return {{
|
||||
"bicubic.upsample_sizes_1x2x4x3_to_1x5x6x3_nhwc",
|
||||
Shape{1, 2, 4, 3},
|
||||
{5, 6},
|
||||
Shape{1, 5, 6, 3},
|
||||
{},
|
||||
{1, 2},
|
||||
{InterpolateMode::BICUBIC_PILLOW, ShapeCalcMode::SIZES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{168, 92, 157, 111, 15, 138, 97, 47, 237, 25, 163, 6,
|
||||
72, 118, 121, 238, 22, 174, 182, 140, 43, 121, 158, 242},
|
||||
std::vector<Data_t>{
|
||||
183, 94, 162, 141, 53, 141, 94, 11, 150,
|
||||
93, 27, 255, 49, 105, 119, 10, 172, -35 /* clip to 0 for unsigned */,
|
||||
165, 99, 155, 143, 55, 143, 116, 14, 152,
|
||||
108, 42, 226, 64, 113, 122, 26, 170, 8,
|
||||
117, 111, 138, 148, 60, 148, 175, 22, 155,
|
||||
148, 80, 143, 102, 133, 131, 69, 165, 123,
|
||||
68, 122, 121, 152, 65, 153, 233, 29, 158,
|
||||
188, 118, 60, 140, 153, 140, 111, 160, 238,
|
||||
50, 127, 114, 154, 67, 155, 255, 32, 160,
|
||||
203, 133, 29, 155, 161, 143, 127, 158, 281 /* clip to 255 for unsigned */
|
||||
},
|
||||
-0.5, // cube_coeff
|
||||
}};
|
||||
}
|
||||
|
||||
template <typename Data_t = float>
|
||||
std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bilinear_pil_float() {
|
||||
return {
|
||||
@ -1170,6 +1290,74 @@ std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bilinear_pil_
|
||||
73.72, 44.132, 53.9285, 71.122, 160.18, 148.9425, 126.71333, 82.746666,
|
||||
60.8625, 49.97, 116.788, 155.5405, 179.70667, 121.361336, 67.7965, 28.818,
|
||||
105.94, 157.19, 192.955, 131.015, 69.53, 23.53},
|
||||
},
|
||||
{
|
||||
"bilinear.upsample_2D_scales",
|
||||
Shape{2, 4},
|
||||
{},
|
||||
Shape{5, 6},
|
||||
{2.5, 1.5},
|
||||
{0, 1},
|
||||
{InterpolateMode::BILINEAR_PILLOW, ShapeCalcMode::SCALES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{214.42, 66.97, 27.98, 76.41, 105.94, 208.44, 115.53, 23.53},
|
||||
std::vector<Data_t>{214.42, 140.695, 60.47167, 34.478333, 52.195, 76.41, 203.57199, 142.34451,
|
||||
73.72, 44.132, 53.9285, 71.122, 160.18, 148.9425, 126.71333, 82.746666,
|
||||
60.8625, 49.97, 116.788, 155.5405, 179.70667, 121.361336, 67.7965, 28.818,
|
||||
105.94, 157.19, 192.955, 131.015, 69.53, 23.53},
|
||||
}};
|
||||
}
|
||||
|
||||
template <element::Type_t ET>
|
||||
std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bilinear_pil_f16() {
|
||||
using Data_t = typename element_type_traits<ET>::value_type;
|
||||
return {
|
||||
{
|
||||
"bilinear.downsample_2D_sizes",
|
||||
Shape{5, 6},
|
||||
{2, 4},
|
||||
Shape{2, 4},
|
||||
{},
|
||||
{0, 1},
|
||||
{InterpolateMode::BILINEAR_PILLOW, ShapeCalcMode::SIZES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{121, 131, 193, 243, 8.875, 37, 210, 242, 63.75, 80, 222, 108, 70, 212, 66,
|
||||
105, 164, 140, 22, 7.0625, 222, 192, 214, 138, 209, 84, 116, 202, 31.75, 77.5},
|
||||
std::vector<Data_t>{159, 141, 138, 111, 96, 128, 158, 128},
|
||||
},
|
||||
{
|
||||
"bilinear.downsample_2D_scales",
|
||||
Shape{5, 6},
|
||||
{},
|
||||
Shape{2, 4},
|
||||
{0.4f, 0.7f},
|
||||
{0, 1},
|
||||
{InterpolateMode::BILINEAR_PILLOW, ShapeCalcMode::SCALES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{121, 131, 193, 243, 8.875, 37, 210, 242, 63.75, 80, 222, 108, 70, 212, 66,
|
||||
105, 164, 140, 22, 7.0625, 222, 192, 214, 138, 209, 84, 116, 202, 31.75, 77.5},
|
||||
std::vector<Data_t>{159, 141, 138, 111, 96, 128, 158, 128},
|
||||
},
|
||||
{
|
||||
"bilinear.upsample_2D_sizes",
|
||||
Shape{2, 4},
|
||||
{5, 6},
|
||||
Shape{5, 6},
|
||||
{},
|
||||
{0, 1},
|
||||
{InterpolateMode::BILINEAR_PILLOW, ShapeCalcMode::SIZES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{214, 67, 28, 76, 106, 208, 115.5, 23.5},
|
||||
std::vector<Data_t>{214, 140, 60.5, 34.5, 52, 76, 202, 142, 74, 44, 53.5, 70, 160, 148, 126,
|
||||
82, 60.75, 49.75, 116, 155, 178, 120, 67.5, 28.75, 106, 157, 192, 130, 69.5, 23.5},
|
||||
},
|
||||
{
|
||||
"bilinear.upsample_2D_scales",
|
||||
Shape{2, 4},
|
||||
{},
|
||||
Shape{5, 6},
|
||||
{2.5f, 1.5f},
|
||||
{0, 1},
|
||||
{InterpolateMode::BILINEAR_PILLOW, ShapeCalcMode::SCALES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{214, 67, 28, 76, 106, 208, 115.5, 23.5},
|
||||
std::vector<Data_t>{214, 140, 60.5, 34.5, 52, 76, 202, 142, 74, 44, 53.5, 70, 160, 148, 126,
|
||||
82, 60.75, 49.75, 116, 155, 178, 120, 67.5, 28.75, 106, 157, 192, 130, 69.5, 23.5},
|
||||
}};
|
||||
}
|
||||
|
||||
@ -1204,6 +1392,20 @@ std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bicubic_pil_f
|
||||
std::vector<Data_t>{162.90814, 143.26627, 138.46507, 109.5325, 92.69513, 126.17204, 164.13477, 127.86513},
|
||||
-0.5, // cube_coeff
|
||||
},
|
||||
{
|
||||
"bicubic.downsample_2D_scales_default_axes",
|
||||
Shape{5, 6},
|
||||
{},
|
||||
Shape{2, 4},
|
||||
{0.4f, 0.7f},
|
||||
{}, // default axes {0, 1}
|
||||
{InterpolateMode::BICUBIC_PILLOW, ShapeCalcMode::SCALES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{121.14, 131.03, 193.32, 243.32, 8.92, 36.9, 210.67, 242.85, 63.8, 79.83,
|
||||
222.47, 108.37, 69.93, 211.89, 65.79, 104.75, 164.82, 140.7, 21.95, 7.06,
|
||||
221.59, 192.9, 214.5, 137.76, 209.29, 84.41, 115.89, 201.84, 31.72, 77.62},
|
||||
std::vector<Data_t>{162.90814, 143.26627, 138.46507, 109.5325, 92.69513, 126.17204, 164.13477, 127.86513},
|
||||
-0.5, // cube_coeff
|
||||
},
|
||||
{
|
||||
"bicubic.downsample_2D_sizes_cube_coeff_ov_default",
|
||||
Shape{5, 6},
|
||||
@ -1233,6 +1435,22 @@ std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bicubic_pil_f
|
||||
std::vector<Data_t>{162.16028, 136.76193, 118.96405, 95.98418, 151.06361, 137.54117},
|
||||
-0.5, // cube_coeff
|
||||
},
|
||||
{
|
||||
"bicubic.upsample_negative_out_val_2D_sizes",
|
||||
Shape{2, 4},
|
||||
{5, 6},
|
||||
Shape{5, 6},
|
||||
{},
|
||||
{0, 1},
|
||||
{InterpolateMode::BICUBIC_PILLOW, ShapeCalcMode::SIZES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{0.1875, 1.1875, 10.1875, 50.1875, 100.1875, 99.1875, 999.1875, 1000.1875},
|
||||
std::vector<Data_t>{-9.77841, -4.4676228, -18.490986, -80.825874, -69.36307, -41.225075,
|
||||
6.6730685, 3.1702557, 15.340315, 64.80558, 98.734406, 114.720276,
|
||||
50.09375, 23.329044, 104.63187, 449.17325, 542.39703, 526.30963,
|
||||
93.51443, 43.48783, 193.92343, 833.54095, 986.0597, 937.899,
|
||||
109.96591, 51.12571, 227.75473, 979.17236, 1154.1572, 1093.8444},
|
||||
-0.5, // cube_coeff
|
||||
},
|
||||
{
|
||||
"bicubic.upsample_2D_sizes",
|
||||
Shape{2, 4},
|
||||
@ -1247,6 +1465,125 @@ std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bicubic_pil_f
|
||||
56.342354, 48.53678, 107.38538, 158.83333, 194.35027, 126.33732, 60.70116, 21.549273,
|
||||
86.82202, 160.8605, 219.21736, 143.63092, 62.35265, 11.32409},
|
||||
-0.5, // cube_coeff
|
||||
},
|
||||
{
|
||||
"bicubic.upsample_2D_sizes_default_axes",
|
||||
Shape{2, 4},
|
||||
{5, 6},
|
||||
Shape{5, 6},
|
||||
{},
|
||||
{}, // default axes {0, 1}
|
||||
{InterpolateMode::BICUBIC_PILLOW, ShapeCalcMode::SIZES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{214.42, 66.97, 27.98, 76.41, 105.94, 208.44, 115.53, 23.53},
|
||||
std::vector<Data_t>{236.49521, 146.10538, 38.218796, 17.75709, 50.332058, 85.74947, 215.93185, 148.13255,
|
||||
63.085896, 35.050694, 51.983547, 75.524284, 161.65862, 153.48294, 128.71808, 80.69401,
|
||||
56.342354, 48.53678, 107.38538, 158.83333, 194.35027, 126.33732, 60.70116, 21.549273,
|
||||
86.82202, 160.8605, 219.21736, 143.63092, 62.35265, 11.32409},
|
||||
-0.5, // cube_coeff
|
||||
}};
|
||||
}
|
||||
|
||||
template <element::Type_t ET>
|
||||
std::vector<InterpolateV11TestParams> generateParamsForInterpolate_bicubic_pil_f16() {
|
||||
using Data_t = typename element_type_traits<ET>::value_type;
|
||||
return {
|
||||
{
|
||||
"bicubic.downsample_2D_sizes",
|
||||
Shape{5, 6},
|
||||
{2, 4},
|
||||
Shape{2, 4},
|
||||
{},
|
||||
{0, 1},
|
||||
{InterpolateMode::BICUBIC_PILLOW, ShapeCalcMode::SIZES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{
|
||||
121, 131, 193, 243, 8.875, 37, 210, 242, 63.75, 80, 222, 108, 70, 212, 66,
|
||||
105, 164, 140, 22, 7.0625, 222, 192, 214, 138, 209, 84, 116, 202, 31.75, 77.5,
|
||||
},
|
||||
std::vector<Data_t>{162, 142, 137, 108.5, 91.5, 126, 163, 126.5},
|
||||
-0.5, // cube_coeff
|
||||
},
|
||||
{
|
||||
"bicubic.downsample_2D_scales",
|
||||
Shape{5, 6},
|
||||
{},
|
||||
Shape{2, 4},
|
||||
{0.4f, 0.7f},
|
||||
{0, 1},
|
||||
{InterpolateMode::BICUBIC_PILLOW, ShapeCalcMode::SCALES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{121, 131, 193, 243, 8.875, 37, 210, 242, 63.75, 80, 222, 108, 70, 212, 66,
|
||||
105, 164, 140, 22, 7.0625, 222, 192, 214, 138, 209, 84, 116, 202, 31.75, 77.5},
|
||||
std::vector<Data_t>{162, 142, 137, 108.5, 91.5, 126, 163, 126.5},
|
||||
-0.5, // cube_coeff
|
||||
},
|
||||
{
|
||||
"bicubic.downsample_2D_sizes_cube_coeff_ov_default",
|
||||
Shape{5, 6},
|
||||
{2, 4},
|
||||
Shape{2, 4},
|
||||
{},
|
||||
{0, 1},
|
||||
{InterpolateMode::BICUBIC_PILLOW, ShapeCalcMode::SIZES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{121.14, 131.03, 193.32, 243.32, 8.92, 36.9, 210.67, 242.85, 63.8, 79.83,
|
||||
222.47, 108.37, 69.93, 211.89, 65.79, 104.75, 164.82, 140.7, 21.95, 7.06,
|
||||
221.59, 192.9, 214.5, 137.76, 209.29, 84.41, 115.89, 201.84, 31.72, 77.62},
|
||||
std::vector<
|
||||
Data_t>{162.548325, 144.773224, 138.243408, 110.827049, 92.899925, 125.124802, 164.711548, 129.240463},
|
||||
// default cube_coeff -0.75
|
||||
},
|
||||
{
|
||||
"bicubic.downsample_to_2x3_2D_scales",
|
||||
Shape{5, 6},
|
||||
{},
|
||||
Shape{2, 3},
|
||||
{0.4f, 0.6666f},
|
||||
{0, 1},
|
||||
{InterpolateMode::BICUBIC_PILLOW, ShapeCalcMode::SCALES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{
|
||||
121, 131, 193, 243, 8.875, 37, 210, 242, 63.75, 80, 222, 108, 70, 212, 66,
|
||||
105, 164, 140, 22, 7.0625, 222, 192, 214, 138, 209, 84, 116, 202, 31.75, 77.5,
|
||||
},
|
||||
std::vector<Data_t>{160, 136, 118, 95, 150, 137},
|
||||
-0.5, // cube_coeff
|
||||
},
|
||||
{
|
||||
"bicubic.upsample_negative_out_val_2D_sizes",
|
||||
Shape{2, 4},
|
||||
{5, 6},
|
||||
Shape{5, 6},
|
||||
{},
|
||||
{0, 1},
|
||||
{InterpolateMode::BICUBIC_PILLOW, ShapeCalcMode::SIZES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{0.1875, 1.1875, 10.1875, 50.1875, 100.1875, 99.1875, 999.1875, 1000.1875},
|
||||
std::vector<Data_t>{-9.75, -4.5, -18.5, -80.5, -69, -41.5, 6.6875, 3.1875, 15.375, 64,
|
||||
98, 114.5, 50, 23.5, 105, 448, 536, 528, 93, 43.5,
|
||||
194, 828, 976, 936, 110, 51.5, 228, 976, 1152, 1088},
|
||||
-0.5, // cube_coeff
|
||||
},
|
||||
{
|
||||
"bicubic.upsample_2D_sizes",
|
||||
Shape{2, 4},
|
||||
{5, 6},
|
||||
Shape{5, 6},
|
||||
{},
|
||||
{0, 1},
|
||||
{InterpolateMode::BICUBIC_PILLOW, ShapeCalcMode::SIZES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{214.42, 66.97, 27.98, 76.41, 105.94, 208.44, 115.53, 23.53},
|
||||
std::vector<Data_t>{236, 144, 38, 18, 50, 85, 216, 146, 63, 35, 51.5, 75, 162, 152, 128,
|
||||
80, 56, 48, 107, 158, 193, 125, 60.25, 21.5, 87, 160, 218, 142, 62, 11.1875},
|
||||
-0.5, // cube_coeff
|
||||
},
|
||||
{
|
||||
"bicubic.upsample_2D_scales",
|
||||
Shape{2, 4},
|
||||
{},
|
||||
Shape{5, 6},
|
||||
{2.5, 1.5},
|
||||
{0, 1},
|
||||
{InterpolateMode::BICUBIC_PILLOW, ShapeCalcMode::SCALES, {0, 0}, {0, 0}},
|
||||
std::vector<Data_t>{214.42, 66.97, 27.98, 76.41, 105.94, 208.44, 115.53, 23.53},
|
||||
std::vector<Data_t>{236, 144, 38, 18, 50, 85, 216, 146, 63, 35, 51.5, 75, 162, 152, 128,
|
||||
80, 56, 48, 107, 158, 193, 125, 60.25, 21.5, 87, 160, 218, 142, 62, 11.1875},
|
||||
-0.5, // cube_coeff
|
||||
}};
|
||||
}
|
||||
|
||||
@ -1254,8 +1591,18 @@ std::vector<InterpolateV11TestParams> generateCombinedParamsForInterpolate_v11()
|
||||
const std::vector<std::vector<InterpolateV11TestParams>> allTypeParamsV11{
|
||||
generateParamsForInterpolate_bilinear_pil_float<float>(),
|
||||
generateParamsForInterpolate_bicubic_pil_float<float>(),
|
||||
generateParamsForInterpolate_bilinear_pil_int<uint8_t>(),
|
||||
generateParamsForInterpolate_bicubic_pil_int<uint8_t>()};
|
||||
generateParamsForInterpolate_bilinear_pil_f16<element::Type_t::bf16>(),
|
||||
generateParamsForInterpolate_bilinear_pil_f16<element::Type_t::f16>(),
|
||||
generateParamsForInterpolate_bicubic_pil_f16<element::Type_t::bf16>(),
|
||||
generateParamsForInterpolate_bicubic_pil_f16<element::Type_t::f16>(),
|
||||
generateParamsForInterpolate_bilinear_pil_int_common<uint8_t>(),
|
||||
generateParamsForInterpolate_bilinear_pil_int_common<int32_t>(),
|
||||
generateParamsForInterpolate_bilinear_pil_int8<int8_t>(),
|
||||
generateParamsForInterpolate_bicubic_pil_int_common<uint8_t>(),
|
||||
generateParamsForInterpolate_bicubic_pil_int_common<int32_t>(),
|
||||
generateParamsForInterpolate_bicubic_pil_uint8<uint8_t>(),
|
||||
generateParamsForInterpolate_bicubic_pil_int8<int8_t>(),
|
||||
generateParamsForInterpolate_bicubic_pil_int32<int32_t>()};
|
||||
|
||||
const std::vector<std::vector<attribute_tests::InterpolateV4TestParams>> allTypeParamsV4{
|
||||
attribute_tests::generateParamsForInterpolate_v4_cubic(),
|
||||
@ -1311,8 +1658,12 @@ private:
|
||||
op::v0::Constant::create<int64_t>(element::i64, Shape{spatial_shape_data.size()}, spatial_shape_data);
|
||||
}
|
||||
const auto& axes_data = param.axes_data;
|
||||
auto axes = op::v0::Constant::create<int64_t>(element::i64, Shape{axes_data.size()}, axes_data);
|
||||
auto interpolate = std::make_shared<op::v11::Interpolate>(image, sizes_or_scales, axes, param.attrs);
|
||||
if (!axes_data.empty()) {
|
||||
auto axes = op::v0::Constant::create<int64_t>(element::i64, Shape{axes_data.size()}, axes_data);
|
||||
auto interpolate = std::make_shared<op::v11::Interpolate>(image, sizes_or_scales, axes, param.attrs);
|
||||
return std::make_shared<Model>(NodeVector{interpolate}, ParameterVector{image});
|
||||
}
|
||||
auto interpolate = std::make_shared<op::v11::Interpolate>(image, sizes_or_scales, param.attrs);
|
||||
return std::make_shared<Model>(NodeVector{interpolate}, ParameterVector{image});
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user