[GPU] Added Pad/Interpolate dynamic support and MVN dynamic tests (#13874)
* [GPU] Pad dynamic * [GPU] Added MVN dynamic tests * [GPU] Interpolate dynamic
This commit is contained in:
parent
c1733b5542
commit
4dd75a1b8b
@ -39,7 +39,7 @@ struct resample : public primitive_base<resample> {
|
||||
: primitive_base(id, {input}, output_padding),
|
||||
output_size(output_size),
|
||||
num_filter(num_filter),
|
||||
output_pattern({}),
|
||||
sizes({}),
|
||||
scales({}),
|
||||
axes({}),
|
||||
pads_begin({}),
|
||||
@ -57,43 +57,10 @@ struct resample : public primitive_base<resample> {
|
||||
}
|
||||
}
|
||||
|
||||
/// @brief resample with dynamic pattern
|
||||
/// @brief resample with constant inputs
|
||||
resample(const primitive_id& id,
|
||||
const primitive_id& input,
|
||||
const primitive_id& pattern_id,
|
||||
const std::vector<float>& scales,
|
||||
const std::vector<int64_t>& axes,
|
||||
const std::vector<size_t>& pads_begin = {},
|
||||
const std::vector<size_t>& pads_end = {},
|
||||
int32_t antialias = 0,
|
||||
float cube_coeff = -0.75f,
|
||||
InterpolateOp::InterpolateMode operation_type = InterpolateOp::InterpolateMode::LINEAR,
|
||||
InterpolateOp::ShapeCalcMode shape_calc_mode = InterpolateOp::ShapeCalcMode::SIZES,
|
||||
InterpolateOp::CoordinateTransformMode ctm = InterpolateOp::CoordinateTransformMode::HALF_PIXEL,
|
||||
InterpolateOp::NearestMode nm = InterpolateOp::NearestMode::ROUND_PREFER_FLOOR,
|
||||
const padding& output_padding = padding())
|
||||
: primitive_base(id, {input, pattern_id}, output_padding),
|
||||
output_size(tensor()),
|
||||
num_filter(0),
|
||||
output_pattern({}),
|
||||
scales(scales),
|
||||
axes(axes),
|
||||
pads_begin(pads_begin),
|
||||
pads_end(pads_end),
|
||||
operation_type(operation_type),
|
||||
shape_calc_mode(shape_calc_mode),
|
||||
antialias(antialias),
|
||||
cube_coeff(cube_coeff),
|
||||
coord_trans_mode(ctm),
|
||||
round_mode(nm) {
|
||||
if (scales.size() != axes.size())
|
||||
throw std::runtime_error("Resample's scales/axes count does not match");
|
||||
}
|
||||
|
||||
/// @brief reshape with static pattern
|
||||
resample(const primitive_id& id,
|
||||
const primitive_id& input,
|
||||
const std::vector<int64_t>& output_pattern,
|
||||
const std::vector<int64_t>& sizes,
|
||||
const std::vector<float>& scales,
|
||||
const std::vector<int64_t>& axes,
|
||||
const std::vector<size_t>& pads_begin = {},
|
||||
@ -108,7 +75,7 @@ struct resample : public primitive_base<resample> {
|
||||
: primitive_base(id, {input}, output_padding),
|
||||
output_size(tensor()),
|
||||
num_filter(0),
|
||||
output_pattern(output_pattern),
|
||||
sizes(sizes),
|
||||
scales(scales),
|
||||
axes(axes),
|
||||
pads_begin(pads_begin),
|
||||
@ -123,6 +90,69 @@ struct resample : public primitive_base<resample> {
|
||||
throw std::runtime_error("Resample's scales/axes count does not match");
|
||||
}
|
||||
|
||||
/// @brief resample with non-constant sizes
|
||||
resample(const primitive_id& id,
|
||||
const primitive_id& input,
|
||||
const primitive_id& sizes_id,
|
||||
const std::vector<float>& scales,
|
||||
const std::vector<int64_t>& axes,
|
||||
const std::vector<size_t>& pads_begin = {},
|
||||
const std::vector<size_t>& pads_end = {},
|
||||
int32_t antialias = 0,
|
||||
float cube_coeff = -0.75f,
|
||||
InterpolateOp::InterpolateMode operation_type = InterpolateOp::InterpolateMode::LINEAR,
|
||||
InterpolateOp::ShapeCalcMode shape_calc_mode = InterpolateOp::ShapeCalcMode::SIZES,
|
||||
InterpolateOp::CoordinateTransformMode ctm = InterpolateOp::CoordinateTransformMode::HALF_PIXEL,
|
||||
InterpolateOp::NearestMode nm = InterpolateOp::NearestMode::ROUND_PREFER_FLOOR,
|
||||
const padding& output_padding = padding())
|
||||
: primitive_base(id, {input, sizes_id}, output_padding),
|
||||
output_size(tensor()),
|
||||
num_filter(0),
|
||||
sizes({}),
|
||||
scales(scales),
|
||||
axes(axes),
|
||||
pads_begin(pads_begin),
|
||||
pads_end(pads_end),
|
||||
operation_type(operation_type),
|
||||
shape_calc_mode(shape_calc_mode),
|
||||
antialias(antialias),
|
||||
cube_coeff(cube_coeff),
|
||||
coord_trans_mode(ctm),
|
||||
round_mode(nm) {
|
||||
if (scales.size() != axes.size())
|
||||
throw std::runtime_error("Resample's scales/axes count does not match");
|
||||
}
|
||||
|
||||
/// @brief resample with non-constant scales
|
||||
resample(const primitive_id& id,
|
||||
const primitive_id& input,
|
||||
const std::vector<int64_t>& sizes,
|
||||
const primitive_id& scales_id,
|
||||
const std::vector<int64_t>& axes,
|
||||
const std::vector<size_t>& pads_begin = {},
|
||||
const std::vector<size_t>& pads_end = {},
|
||||
int32_t antialias = 0,
|
||||
float cube_coeff = -0.75f,
|
||||
InterpolateOp::InterpolateMode operation_type = InterpolateOp::InterpolateMode::LINEAR,
|
||||
InterpolateOp::ShapeCalcMode shape_calc_mode = InterpolateOp::ShapeCalcMode::SCALES,
|
||||
InterpolateOp::CoordinateTransformMode ctm = InterpolateOp::CoordinateTransformMode::HALF_PIXEL,
|
||||
InterpolateOp::NearestMode nm = InterpolateOp::NearestMode::ROUND_PREFER_FLOOR,
|
||||
const padding& output_padding = padding())
|
||||
: primitive_base(id, {input, scales_id}, output_padding),
|
||||
output_size(tensor()),
|
||||
num_filter(0),
|
||||
sizes({}),
|
||||
scales({}),
|
||||
axes(axes),
|
||||
pads_begin(pads_begin),
|
||||
pads_end(pads_end),
|
||||
operation_type(operation_type),
|
||||
shape_calc_mode(shape_calc_mode),
|
||||
antialias(antialias),
|
||||
cube_coeff(cube_coeff),
|
||||
coord_trans_mode(ctm),
|
||||
round_mode(nm) {}
|
||||
|
||||
InterpolateOp::InterpolateAttrs get_attrs() const {
|
||||
return InterpolateOp::InterpolateAttrs(this->operation_type,
|
||||
this->shape_calc_mode,
|
||||
@ -137,8 +167,8 @@ struct resample : public primitive_base<resample> {
|
||||
tensor output_size;
|
||||
/// @param num_filter Input filter. Only used by bilinear sample_type.
|
||||
uint32_t num_filter;
|
||||
/// @param output_pattern Describing output shape for spatial axes.
|
||||
std::vector<int64_t> output_pattern;
|
||||
/// @param sizes Describing output shape for spatial axes.
|
||||
std::vector<int64_t> sizes;
|
||||
/// @param scales Scales of spatial axes, i.e. output_shape / input_shape
|
||||
std::vector<float> scales;
|
||||
/// @param axes Interpolation axes.
|
||||
|
@ -106,6 +106,9 @@ std::string border_inst::to_string(border_node const& node) {
|
||||
|
||||
border_inst::typed_primitive_inst(network& network, border_node const& node) : parent(network, node) {
|
||||
auto input_layout = node.input().get_output_layout();
|
||||
if (input_layout.is_dynamic()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& input_sizes = input_layout.get_dims();
|
||||
auto pad_mode = argument->pad_mode;
|
||||
|
@ -362,7 +362,8 @@ void minimize_local_reorders(program& p, std::map<program_node*, format::type>&
|
||||
auto reorders_cnt = count_reorders(fmt_map, lo, node);
|
||||
|
||||
if (reorders_cnt.number < best_reorder_cnt.number ||
|
||||
(reorders_cnt.number == best_reorder_cnt.number && reorders_cnt.total_sizes < best_reorder_cnt.total_sizes)) {
|
||||
(reorders_cnt.number == best_reorder_cnt.number && reorders_cnt.total_sizes < best_reorder_cnt.total_sizes
|
||||
&& !node->get_output_layout().is_dynamic())) {
|
||||
best_reorder_cnt = reorders_cnt;
|
||||
best_format = new_fmt;
|
||||
}
|
||||
|
@ -150,8 +150,16 @@ struct resample_impl : typed_primitive_impl_ocl<resample> {
|
||||
us_params.pads_begin = convert_pads(primitive->pads_begin, dimsNum);
|
||||
us_params.pads_end = convert_pads(primitive->pads_end, dimsNum);
|
||||
|
||||
for (size_t i = 0; i < primitive->scales.size(); i++) {
|
||||
us_params.axesAndScales[convert_axis(primitive->axes[i], dimsNum)] = primitive->scales[i];
|
||||
auto scales = primitive->scales;
|
||||
bool scales_calc_mod = primitive->shape_calc_mode == resample::InterpolateOp::ShapeCalcMode::SCALES;
|
||||
if (scales_calc_mod && impl_param.input_layouts.size() == 2 && scales.empty()) {
|
||||
auto mem = impl_param.memory_deps.at(1);
|
||||
float* buffer = static_cast<float*>(mem->buffer_ptr());
|
||||
scales = std::vector<float>(buffer, buffer + mem->count());
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < scales.size(); ++i) {
|
||||
us_params.axesAndScales[convert_axis(primitive->axes[i], dimsNum)] = scales[i];
|
||||
}
|
||||
|
||||
auto& kernel_selector = kernel_selector::resample_kernel_selector::Instance();
|
||||
|
@ -31,36 +31,66 @@ layout resample_inst::calc_output_layout(resample_node const& node, kernel_impl_
|
||||
output_type = impl_param.get_fused_output_layout().data_type;
|
||||
}
|
||||
|
||||
return desc->output_pattern.empty() ? layout({output_type, input_layout.format, desc->output_size}) :
|
||||
layout({desc->output_pattern, output_type, input_layout.format});
|
||||
return desc->sizes.empty() ? layout({output_type, input_layout.format, desc->output_size}) :
|
||||
layout({desc->sizes, output_type, input_layout.format});
|
||||
}
|
||||
|
||||
template<typename ShapeType>
|
||||
std::vector<layout> resample_inst::calc_output_layouts(resample_node const& /*node*/, const kernel_impl_params& impl_param) {
|
||||
auto desc = impl_param.typed_desc<resample>();
|
||||
auto input_layout = impl_param.get_input_layout(0);
|
||||
|
||||
auto& memory_deps = impl_param.memory_deps;
|
||||
auto input_shape = input_layout.get<ShapeType>();
|
||||
size_t input_rank = input_shape.size();
|
||||
|
||||
ov::op::v4::Interpolate op;
|
||||
op.set_attrs(desc->get_attrs());
|
||||
|
||||
ShapeType pattern_shape = impl_param.input_layouts.size() == 2 ? impl_param.input_layouts[1].get<ShapeType>()
|
||||
: ov::Shape{ desc->output_pattern.size() };
|
||||
ShapeType sizes_shape = desc->sizes.empty() ? ov::Shape{ input_rank }
|
||||
: ov::Shape{ desc->sizes.size() };
|
||||
ShapeType scales_shape = desc->scales.empty() ? ov::Shape{ input_rank }
|
||||
: ov::Shape{ desc->scales.size() };
|
||||
std::vector<ShapeType> output_shapes = {ShapeType()};
|
||||
std::vector<ShapeType> input_shapes = {
|
||||
impl_param.input_layouts[0].get<ShapeType>(),
|
||||
pattern_shape,
|
||||
ov::Shape{ desc->scales.size() },
|
||||
input_shape,
|
||||
sizes_shape,
|
||||
scales_shape,
|
||||
ov::Shape{ desc->axes.size() }
|
||||
};
|
||||
|
||||
auto& memory_deps = impl_param.memory_deps;
|
||||
std::map<size_t, ngraph::HostTensorPtr> const_data;
|
||||
|
||||
auto sizes_data = desc->sizes;
|
||||
auto scales_data = desc->scales;
|
||||
auto scales_tensor = make_host_tensor({ ov::PartialShape{ ov::Shape{scales_data.size()} }, data_types::f32, format::bfyx },
|
||||
static_cast<void*>(scales_data.data()));
|
||||
const_data.emplace(2, scales_tensor);
|
||||
|
||||
bool sizes_calc_mod = desc->get_attrs().shape_calculation_mode == ov::op::v4::Interpolate::ShapeCalcMode::SIZES;
|
||||
|
||||
if ((sizes_data.empty() || !sizes_calc_mod) && (scales_data.empty() || sizes_calc_mod) && !memory_deps.count(1)) {
|
||||
return { layout{ShapeType::dynamic(input_rank), input_layout.data_type, input_layout.format} };
|
||||
}
|
||||
|
||||
if (!sizes_data.empty()) {
|
||||
auto sizes_tensor = make_host_tensor({ sizes_shape, data_types::i64, format::bfyx }, static_cast<void*>(sizes_data.data()));
|
||||
const_data.emplace(1, sizes_tensor);
|
||||
}
|
||||
|
||||
if (!scales_data.empty()) {
|
||||
auto scales_tensor = make_host_tensor({ scales_shape, data_types::f32, format::bfyx }, static_cast<void*>(scales_data.data()));
|
||||
const_data.emplace(2, scales_tensor);
|
||||
}
|
||||
|
||||
if (memory_deps.count(1)) {
|
||||
auto mem = memory_deps.at(1);
|
||||
cldnn::mem_lock<uint8_t, mem_lock_type::read> lock(mem, impl_param.prog->get_stream());
|
||||
auto ptr = lock.data();
|
||||
auto tensor = make_host_tensor(mem->get_layout(), ptr);
|
||||
|
||||
if (sizes_calc_mod) {
|
||||
const_data.emplace(1, tensor);
|
||||
} else {
|
||||
const_data.emplace(2, tensor);
|
||||
}
|
||||
}
|
||||
|
||||
auto axes_data = desc->axes;
|
||||
if (axes_data.empty()) {
|
||||
@ -75,23 +105,7 @@ std::vector<layout> resample_inst::calc_output_layouts(resample_node const& /*no
|
||||
auto pads_end = desc->pads_end;
|
||||
ov::op::v4::correct_pads_attr(&op, pads_begin, pads_end, input_shapes);
|
||||
|
||||
auto pattern_data = desc->output_pattern;
|
||||
if (memory_deps.count(1)) {
|
||||
auto pattern_mem = memory_deps.at(1);
|
||||
|
||||
cldnn::mem_lock<uint8_t, mem_lock_type::read> pattern_lock(pattern_mem, impl_param.prog->get_stream());
|
||||
|
||||
auto pattern_ptr = pattern_lock.data();
|
||||
auto pattern_tensor = make_host_tensor(pattern_mem->get_layout(), pattern_ptr);
|
||||
|
||||
const_data.emplace(1, pattern_tensor);
|
||||
ov::op::v4::shape_infer(&op, pads_begin, pads_end, input_shapes, output_shapes, {const_data});
|
||||
} else {
|
||||
auto pattern_tensor = make_host_tensor({ pattern_shape, data_types::i64, format::bfyx },
|
||||
static_cast<void*>(pattern_data.data()));
|
||||
const_data.emplace(1, pattern_tensor);
|
||||
ov::op::v4::shape_infer(&op, pads_begin, pads_end, input_shapes, output_shapes, {const_data});
|
||||
}
|
||||
ov::op::v4::shape_infer(&op, pads_begin, pads_end, input_shapes, output_shapes, {const_data});
|
||||
|
||||
return { layout{output_shapes[0], input_layout.data_type, format::adjust_to_rank(input_layout.format, output_shapes[0].size())} };
|
||||
}
|
||||
|
@ -19,26 +19,24 @@ static void CreateInterpolateOp(Program& p, const std::shared_ptr<ngraph::op::v4
|
||||
auto inputPrimitives = p.GetInputPrimitiveIDs(op);
|
||||
std::string layerName = layer_type_name_ID(op);
|
||||
|
||||
static const size_t SIZES_INDEX = 1;
|
||||
static const size_t SCALES_INDEX = 2;
|
||||
static const size_t AXES_INDEX = 3;
|
||||
|
||||
auto attrs = op->get_attrs();
|
||||
auto inputRank = op->get_input_shape(0).size();
|
||||
auto outShape = op->get_output_shape(0);
|
||||
auto outputPattern = std::vector<int64_t>(outShape.begin(), outShape.end());
|
||||
auto inputRank = op->get_input_partial_shape(0).size();
|
||||
|
||||
auto sizes_constant = std::dynamic_pointer_cast<ngraph::op::Constant>(op->get_input_node_shared_ptr(SIZES_INDEX));
|
||||
std::vector<int64_t> sizes = sizes_constant ? sizes_constant->cast_vector<int64_t>() : std::vector<int64_t>{};
|
||||
|
||||
auto scales_constant = std::dynamic_pointer_cast<ngraph::op::Constant>(op->get_input_node_shared_ptr(SCALES_INDEX));
|
||||
if (!scales_constant) {
|
||||
IE_THROW() << "Unsupported parameter node type in " << op->get_friendly_name() << " (" << op->get_type_name() << ")";
|
||||
}
|
||||
std::vector<float> scales = scales_constant->cast_vector<float>();
|
||||
std::vector<float> scales = scales_constant ? scales_constant->cast_vector<float>() : std::vector<float>{};
|
||||
|
||||
std::vector<int64_t> axes;
|
||||
if (op->get_input_size() == 4) {
|
||||
auto axes_constant = std::dynamic_pointer_cast<ngraph::op::Constant>(op->get_input_node_shared_ptr(AXES_INDEX));
|
||||
if (!axes_constant) {
|
||||
IE_THROW() << "Unsupported parameter node type in " << op->get_friendly_name() << " (" << op->get_type_name() << ")";
|
||||
}
|
||||
OPENVINO_ASSERT(axes_constant, "Unsupported parameter node type in ", op->get_friendly_name(), " (", op->get_type_name(), ")");
|
||||
|
||||
axes = axes_constant->cast_vector<int64_t>();
|
||||
ov::normalize_axes(op.get(), inputRank, axes);
|
||||
} else {
|
||||
@ -47,53 +45,106 @@ static void CreateInterpolateOp(Program& p, const std::shared_ptr<ngraph::op::v4
|
||||
}
|
||||
}
|
||||
|
||||
if (axes.size() != scales.size())
|
||||
IE_THROW() << op->get_friendly_name() << " Incorrect axes and scales should be the same size";
|
||||
OPENVINO_ASSERT(!scales_constant || axes.size() == scales.size(), op->get_friendly_name(), " Incorrect axes and scales should be the same size");
|
||||
|
||||
// TODO shouldn't be all this checking done in ngraph::op::v4::Interpolate?
|
||||
auto interpolateMode = attrs.mode;
|
||||
if (interpolateMode == ov::op::v4::Interpolate::InterpolateMode::LINEAR_ONNX) {
|
||||
if (inputRank != 2 && inputRank != 4 && inputRank != 5)
|
||||
IE_THROW() << "mode 'linear_onnx' supports only 2D or 4D, 5D tensors";
|
||||
if (axes.size() != 2 && axes.size() != 3 && inputRank != axes.size())
|
||||
IE_THROW() << "mode 'linear_onnx' supports only axes with size 2, 3 or equal to input rank";
|
||||
OPENVINO_ASSERT(inputRank == 2 || inputRank == 4 || inputRank == 5, "Mode 'linear_onnx' supports only 2D or 4D, 5D tensors");
|
||||
|
||||
OPENVINO_ASSERT(axes.size() == 2 || axes.size() == 3 || inputRank == axes.size(),
|
||||
"Mode 'linear_onnx' supports only axes with size 2, 3 or equal to input rank");
|
||||
|
||||
bool correctAxes =
|
||||
(((axes.size() == 2 || axes.size() == 4) && inputRank < 5) &&
|
||||
((axes.size() == 2 || axes.size() == 4) && inputRank < 5) &&
|
||||
((axes[0] == 0 && axes[1] == 1) ||
|
||||
(axes[0] == 1 && axes[1] == 0) ||
|
||||
(axes[0] == 2 && axes[1] == 3) ||
|
||||
(axes[0] == 3 && axes[1] == 2))) ||
|
||||
((axes.size() == 3 || axes.size() == 5) && inputRank == 5 &&
|
||||
((axes[0] == 0 && axes[1] == 1 && axes[2] == 2) ||
|
||||
(axes[0] == 2 && axes[1] == 3 && axes[2] == 4)));
|
||||
(axes[0] == 1 && axes[1] == 0) ||
|
||||
(axes[0] == 2 && axes[1] == 3) ||
|
||||
(axes[0] == 3 && axes[1] == 2));
|
||||
|
||||
correctAxes |=
|
||||
(axes.size() == 3 || axes.size() == 5) && inputRank == 5 &&
|
||||
((axes[0] == 0 && axes[1] == 1 && axes[2] == 2) ||
|
||||
(axes[0] == 2 && axes[1] == 3 && axes[2] == 4));
|
||||
|
||||
if ((axes.size() == 4 && inputRank == 4) || (axes.size() == 5 && inputRank == 5)) {
|
||||
for (size_t i = 0; i < axes.size(); i++) {
|
||||
for (size_t i = 0; i < axes.size(); ++i) {
|
||||
if (std::find(axes.begin(), axes.end(), i) == axes.end()) {
|
||||
correctAxes = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!correctAxes)
|
||||
IE_THROW() <<
|
||||
"mode 'linear_onnx' supports only case when axes = {2, 3} or "
|
||||
"axes = {0, 1} or axes = {0, 1, 2, 3} or axes = {2, 3, 4} for 5d";
|
||||
OPENVINO_ASSERT(correctAxes, "Mode 'linear_onnx' supports only case when axes = {2, 3} or ",
|
||||
"axes = {0, 1} or axes = {0, 1, 2, 3} or axes = {2, 3, 4} for 5d");
|
||||
}
|
||||
|
||||
auto resamplePrim = cldnn::resample(layerName,
|
||||
inputPrimitives[0],
|
||||
outputPattern,
|
||||
scales,
|
||||
axes,
|
||||
attrs.pads_begin,
|
||||
attrs.pads_end,
|
||||
attrs.antialias,
|
||||
attrs.cube_coeff,
|
||||
interpolateMode,
|
||||
attrs.shape_calculation_mode,
|
||||
attrs.coordinate_transformation_mode,
|
||||
attrs.nearest_mode);
|
||||
std::shared_ptr<cldnn::resample> resamplePrim = nullptr;
|
||||
if (p.use_new_shape_infer()) {
|
||||
if (sizes_constant && scales_constant) {
|
||||
resamplePrim = std::make_shared<cldnn::resample>(layerName,
|
||||
inputPrimitives[0],
|
||||
sizes,
|
||||
scales,
|
||||
axes,
|
||||
attrs.pads_begin,
|
||||
attrs.pads_end,
|
||||
attrs.antialias,
|
||||
attrs.cube_coeff,
|
||||
interpolateMode,
|
||||
attrs.shape_calculation_mode,
|
||||
attrs.coordinate_transformation_mode,
|
||||
attrs.nearest_mode);
|
||||
} else if (scales_constant) {
|
||||
resamplePrim = std::make_shared<cldnn::resample>(layerName,
|
||||
inputPrimitives[0],
|
||||
inputPrimitives[SIZES_INDEX],
|
||||
scales,
|
||||
axes,
|
||||
attrs.pads_begin,
|
||||
attrs.pads_end,
|
||||
attrs.antialias,
|
||||
attrs.cube_coeff,
|
||||
interpolateMode,
|
||||
attrs.shape_calculation_mode,
|
||||
attrs.coordinate_transformation_mode,
|
||||
attrs.nearest_mode);
|
||||
} else if (sizes_constant) {
|
||||
resamplePrim = std::make_shared<cldnn::resample>(layerName,
|
||||
inputPrimitives[0],
|
||||
sizes,
|
||||
inputPrimitives[SCALES_INDEX],
|
||||
axes,
|
||||
attrs.pads_begin,
|
||||
attrs.pads_end,
|
||||
attrs.antialias,
|
||||
attrs.cube_coeff,
|
||||
interpolateMode,
|
||||
attrs.shape_calculation_mode,
|
||||
attrs.coordinate_transformation_mode,
|
||||
attrs.nearest_mode);
|
||||
} else {
|
||||
OPENVINO_ASSERT(false, "Scales and Sizes as parameters are not supported at the same time in ",
|
||||
op->get_friendly_name(), " (", op->get_type_name(), ")");
|
||||
}
|
||||
} else {
|
||||
auto outShape = op->get_output_shape(0);
|
||||
auto outputPattern = std::vector<int64_t>(outShape.begin(), outShape.end());
|
||||
|
||||
resamplePrim = std::make_shared<cldnn::resample>(layerName,
|
||||
inputPrimitives[0],
|
||||
outputPattern,
|
||||
scales,
|
||||
axes,
|
||||
attrs.pads_begin,
|
||||
attrs.pads_end,
|
||||
attrs.antialias,
|
||||
attrs.cube_coeff,
|
||||
interpolateMode,
|
||||
attrs.shape_calculation_mode,
|
||||
attrs.coordinate_transformation_mode,
|
||||
attrs.nearest_mode);
|
||||
}
|
||||
p.add_primitive(*op, resamplePrim);
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ static void CreatePadOp(Program& p, const std::shared_ptr<ngraph::op::v1::Pad>&
|
||||
validate_inputs_count(op, {3, 4});
|
||||
auto inputPrimitives = p.GetInputPrimitiveIDs(op);
|
||||
std::string layerName = layer_type_name_ID(op);
|
||||
size_t rank = std::max(op->get_input_shape(0).size(), static_cast<size_t>(4));
|
||||
size_t rank = std::max(op->get_input_partial_shape(0).size(), static_cast<size_t>(4));
|
||||
|
||||
float pad_value = 0.f;
|
||||
if (op->get_input_size() == 4) {
|
||||
|
@ -80,13 +80,13 @@ INSTANTIATE_TEST_SUITE_P(smoke, interpolate_test_two_inputs,
|
||||
{
|
||||
layout{ov::PartialShape{1, 2, 48, 80}, data_types::f32, format::bfyx},
|
||||
layout{ov::PartialShape{4}, data_types::i64, format::bfyx}, {-1, -1, -1, -1},
|
||||
{0.5, 2.0}, {2, 3}, InterpolateAttrs{InterpolateOp::ShapeCalcMode::SCALES},
|
||||
{1.0f, 1.0f, 0.5f, 2.0f}, {0, 1, 2, 3}, InterpolateAttrs{InterpolateOp::ShapeCalcMode::SCALES},
|
||||
layout{ov::PartialShape{1, 2, 24, 160}, data_types::f32, format::bfyx}
|
||||
},
|
||||
{
|
||||
layout{ov::PartialShape::dynamic(4), data_types::f32, format::bfyx},
|
||||
layout{ov::PartialShape{4}, data_types::i64, format::bfyx}, {-1, -1, -1, -1},
|
||||
{0.5, 2.0}, {2, 3}, InterpolateAttrs{InterpolateOp::ShapeCalcMode::SCALES},
|
||||
{1.0f, 1.0f, 0.5f, 2.0f}, {0, 1, 2, 3}, InterpolateAttrs{InterpolateOp::ShapeCalcMode::SCALES},
|
||||
layout{ov::PartialShape::dynamic(4), data_types::f32, format::bfyx}
|
||||
},
|
||||
{
|
||||
@ -133,13 +133,13 @@ INSTANTIATE_TEST_SUITE_P(smoke, interpolate_test_single_input,
|
||||
{
|
||||
layout{ov::PartialShape{1, 2, 48, 80}, data_types::f32, format::bfyx},
|
||||
layout{ov::PartialShape{4}, data_types::i64, format::bfyx}, {-1, -1, -1, -1},
|
||||
{0.5, 2.0}, {2, 3}, InterpolateAttrs{InterpolateOp::ShapeCalcMode::SCALES},
|
||||
{1.0f, 1.0f, 0.5f, 2.0f}, {0, 1, 2, 3}, InterpolateAttrs{InterpolateOp::ShapeCalcMode::SCALES},
|
||||
layout{ov::PartialShape{1, 2, 24, 160}, data_types::f32, format::bfyx}
|
||||
},
|
||||
{
|
||||
layout{ov::PartialShape::dynamic(4), data_types::f32, format::bfyx},
|
||||
layout{ov::PartialShape{4}, data_types::i64, format::bfyx}, {-1, -1, -1, -1},
|
||||
{0.5, 2.0}, {2, 3}, InterpolateAttrs{InterpolateOp::ShapeCalcMode::SCALES},
|
||||
{1.0f, 1.0f, 0.5f, 2.0f}, {0, 1, 2, 3}, InterpolateAttrs{InterpolateOp::ShapeCalcMode::SCALES},
|
||||
layout{ov::PartialShape::dynamic(4), data_types::f32, format::bfyx}
|
||||
},
|
||||
{
|
||||
|
@ -746,7 +746,7 @@ TEST(resample_gpu, interpolate_in2x2x3x2_nearest1) {
|
||||
auto ctm = resample::InterpolateOp::CoordinateTransformMode::HALF_PIXEL;
|
||||
auto nm = resample::InterpolateOp::NearestMode::CEIL;
|
||||
auto shapeCalcMode = resample::InterpolateOp::ShapeCalcMode::SIZES;
|
||||
topology.add(resample("interpolate", "input", output_pattern, {}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
topology.add(resample("interpolate", "input", output_pattern, std::vector<float>{}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
|
||||
set_values(input, {
|
||||
0.f, 1.f, 2.f,
|
||||
@ -836,7 +836,7 @@ TEST(resample_gpu, interpolate_in2x2x3x2_nearest2) {
|
||||
auto ctm = resample::InterpolateOp::CoordinateTransformMode::HALF_PIXEL;
|
||||
auto nm = resample::InterpolateOp::NearestMode::ROUND_PREFER_FLOOR;
|
||||
auto shapeCalcMode = resample::InterpolateOp::ShapeCalcMode::SIZES;
|
||||
topology.add(resample("interpolate", "input", output_pattern, {}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
topology.add(resample("interpolate", "input", output_pattern, std::vector<float>{}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
|
||||
set_values(input, {
|
||||
0.f, 1.f, 2.f,
|
||||
@ -926,7 +926,7 @@ TEST(resample_gpu, interpolate_in2x2x3x2_nearest3) {
|
||||
auto ctm = resample::InterpolateOp::CoordinateTransformMode::HALF_PIXEL;
|
||||
auto nm = resample::InterpolateOp::NearestMode::ROUND_PREFER_CEIL;
|
||||
auto shapeCalcMode = resample::InterpolateOp::ShapeCalcMode::SIZES;
|
||||
topology.add(resample("interpolate", "input", output_pattern, {}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
topology.add(resample("interpolate", "input", output_pattern, std::vector<float>{}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
|
||||
set_values(input, {
|
||||
0.f, 1.f, 2.f,
|
||||
@ -1016,7 +1016,7 @@ TEST(resample_gpu, interpolate_in2x2x3x2_nearest4) {
|
||||
auto ctm = resample::InterpolateOp::CoordinateTransformMode::HALF_PIXEL;
|
||||
auto nm = resample::InterpolateOp::NearestMode::FLOOR;
|
||||
auto shapeCalcMode = resample::InterpolateOp::ShapeCalcMode::SIZES;
|
||||
topology.add(resample("interpolate", "input", output_pattern, {}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
topology.add(resample("interpolate", "input", output_pattern, std::vector<float>{}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
|
||||
set_values(input, {
|
||||
0.f, 1.f, 2.f,
|
||||
@ -1106,7 +1106,7 @@ TEST(resample_gpu, interpolate_in2x2x3x2_nearest5) {
|
||||
auto ctm = resample::InterpolateOp::CoordinateTransformMode::HALF_PIXEL;
|
||||
auto nm = resample::InterpolateOp::NearestMode::SIMPLE;
|
||||
auto shapeCalcMode = resample::InterpolateOp::ShapeCalcMode::SIZES;
|
||||
topology.add(resample("interpolate", "input", output_pattern, {}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
topology.add(resample("interpolate", "input", output_pattern, std::vector<float>{}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
|
||||
set_values(input, {
|
||||
0.f, 1.f, 2.f,
|
||||
@ -1198,7 +1198,7 @@ TEST(resample_gpu, interpolate_in2x2x3x2_coord_transform_mode1) {
|
||||
auto ctm = resample::InterpolateOp::CoordinateTransformMode::HALF_PIXEL;
|
||||
auto nm = resample::InterpolateOp::NearestMode::ROUND_PREFER_FLOOR;
|
||||
auto shapeCalcMode = resample::InterpolateOp::ShapeCalcMode::SIZES;
|
||||
topology.add(resample("interpolate", "input", output_pattern, {}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
topology.add(resample("interpolate", "input", output_pattern, std::vector<float>{}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
|
||||
set_values(input, {
|
||||
0.f, 1.f, 2.f,
|
||||
@ -1268,7 +1268,7 @@ TEST(resample_gpu, interpolate_in2x2x3x2_coord_transform_mode2) {
|
||||
auto ctm = resample::InterpolateOp::CoordinateTransformMode::PYTORCH_HALF_PIXEL;
|
||||
auto nm = resample::InterpolateOp::NearestMode::ROUND_PREFER_FLOOR;
|
||||
auto shapeCalcMode = resample::InterpolateOp::ShapeCalcMode::SIZES;
|
||||
topology.add(resample("interpolate", "input", output_pattern, {}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
topology.add(resample("interpolate", "input", output_pattern, std::vector<float>{}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
|
||||
set_values(input, {
|
||||
0.f, 1.f, 2.f,
|
||||
@ -1332,7 +1332,7 @@ TEST(resample_gpu, interpolate_in2x2x3x2_coord_transform_mode3) {
|
||||
auto ctm = resample::InterpolateOp::CoordinateTransformMode::ASYMMETRIC;
|
||||
auto nm = resample::InterpolateOp::NearestMode::ROUND_PREFER_FLOOR;
|
||||
auto shapeCalcMode = resample::InterpolateOp::ShapeCalcMode::SIZES;
|
||||
topology.add(resample("interpolate", "input", output_pattern, {}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
topology.add(resample("interpolate", "input", output_pattern, std::vector<float>{}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
|
||||
set_values(input, {
|
||||
0.f, 1.f, 2.f,
|
||||
@ -1402,7 +1402,7 @@ TEST(resample_gpu, interpolate_in2x2x3x2_coord_transform_mode4) {
|
||||
auto ctm = resample::InterpolateOp::CoordinateTransformMode::TF_HALF_PIXEL_FOR_NN;
|
||||
auto nm = resample::InterpolateOp::NearestMode::ROUND_PREFER_FLOOR;
|
||||
auto shapeCalcMode = resample::InterpolateOp::ShapeCalcMode::SIZES;
|
||||
topology.add(resample("interpolate", "input", output_pattern, {}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
topology.add(resample("interpolate", "input", output_pattern, std::vector<float>{}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
|
||||
set_values(input, {
|
||||
0.f, 1.f, 2.f,
|
||||
@ -1472,7 +1472,7 @@ TEST(resample_gpu, interpolate_in2x2x3x2_coord_transform_mode5) {
|
||||
auto ctm = resample::InterpolateOp::CoordinateTransformMode::ALIGN_CORNERS;
|
||||
auto nm = resample::InterpolateOp::NearestMode::ROUND_PREFER_FLOOR;
|
||||
auto shapeCalcMode = resample::InterpolateOp::ShapeCalcMode::SIZES;
|
||||
topology.add(resample("interpolate", "input", output_pattern, {}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
topology.add(resample("interpolate", "input", output_pattern, std::vector<float>{}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode, ctm, nm));
|
||||
|
||||
set_values(input, {
|
||||
0.f, 1.f, 2.f,
|
||||
@ -1540,7 +1540,7 @@ TEST(resample_gpu, interpolate_in2x2x3x2_cubic) {
|
||||
float cube_coeff = -0.75f;
|
||||
auto mode = resample::InterpolateOp::InterpolateMode::CUBIC;
|
||||
auto shapeCalcMode = resample::InterpolateOp::ShapeCalcMode::SIZES;
|
||||
topology.add(resample("interpolate", "input", output_pattern, {}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode));
|
||||
topology.add(resample("interpolate", "input", output_pattern, std::vector<float>{}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode));
|
||||
|
||||
set_values(input, {
|
||||
0.f, 1.f, 2.f,
|
||||
@ -1607,7 +1607,7 @@ TEST(resample_gpu, interpolate_in2x2x3x2_cubic2) {
|
||||
float cube_coeff = -0.75f;
|
||||
auto mode = resample::InterpolateOp::InterpolateMode::CUBIC;
|
||||
auto shapeCalcMode = resample::InterpolateOp::ShapeCalcMode::SIZES;
|
||||
topology.add(resample("interpolate", "input", output_pattern, {}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode));
|
||||
topology.add(resample("interpolate", "input", output_pattern, std::vector<float>{}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode));
|
||||
|
||||
set_values(input, {
|
||||
5.f, 1.f, 2.f,
|
||||
@ -1661,7 +1661,7 @@ TEST(resample_gpu, interpolate_in2x2x3x2_linear) {
|
||||
float cube_coeff = -0.75f;
|
||||
auto mode = resample::InterpolateOp::InterpolateMode::LINEAR;
|
||||
auto shapeCalcMode = resample::InterpolateOp::ShapeCalcMode::SIZES;
|
||||
topology.add(resample("interpolate", "input", output_pattern, {}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode));
|
||||
topology.add(resample("interpolate", "input", output_pattern, std::vector<float>{}, {}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode));
|
||||
|
||||
set_values(input, {
|
||||
0.f, 1.f, 2.f,
|
||||
@ -1889,7 +1889,7 @@ TEST(resample_gpu, interpolate_in1x1x2x4_linear_scale) {
|
||||
auto mode = resample::InterpolateOp::InterpolateMode::LINEAR;
|
||||
auto shapeCalcMode = resample::InterpolateOp::ShapeCalcMode::SCALES;
|
||||
|
||||
topology.add(resample("interpolate", "input", output_pattern, {0.6f, 0.6f}, {2, 3}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode));
|
||||
topology.add(resample("interpolate", "input", output_pattern, std::vector<float>{0.6f, 0.6f}, {2, 3}, {0, 0, 0, 0}, {0, 0, 0, 0}, antialias, cube_coeff, mode, shapeCalcMode));
|
||||
|
||||
set_values(input, {
|
||||
1.f, 2.f, 3.f, 4.f,
|
||||
|
@ -0,0 +1,565 @@
|
||||
// Copyright (C) 2022 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "shared_test_classes/single_layer/interpolate.hpp"
|
||||
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||
#include "ngraph_functions/builders.hpp"
|
||||
#include <common_test_utils/ov_tensor_utils.hpp>
|
||||
#include "openvino/core/preprocess/pre_post_process.hpp"
|
||||
|
||||
using namespace ov::test;
|
||||
using ngraph::helpers::operator<<;
|
||||
|
||||
namespace GPULayerTestsDefinitions {
|
||||
|
||||
using InterpolateSpecificParams = std::tuple<ngraph::op::v4::Interpolate::InterpolateMode, // InterpolateMode
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode, // CoordinateTransformMode
|
||||
ngraph::op::v4::Interpolate::NearestMode, // NearestMode
|
||||
bool, // AntiAlias
|
||||
std::vector<size_t>, // PadBegin
|
||||
std::vector<size_t>, // PadEnd
|
||||
double>; // Cube coef
|
||||
|
||||
using ShapeParams = std::tuple<ngraph::op::v4::Interpolate::ShapeCalcMode, // ShapeCalculationMode
|
||||
InputShape, // Input shapes
|
||||
// params describing input, choice of which depends on ShapeCalcMode
|
||||
ngraph::helpers::InputLayerType, // input type
|
||||
std::vector<std::vector<float>>, // scales or sizes values
|
||||
std::vector<int64_t>>; // axes
|
||||
|
||||
using InterpolateLayerGPUTestParamsSet = std::tuple<InterpolateSpecificParams,
|
||||
ShapeParams,
|
||||
ElementType>;
|
||||
|
||||
class InterpolateLayerGPUTest : public testing::WithParamInterface<InterpolateLayerGPUTestParamsSet>,
|
||||
virtual public SubgraphBaseTest {
|
||||
public:
|
||||
static std::string getTestCaseName(testing::TestParamInfo<InterpolateLayerGPUTestParamsSet> obj) {
|
||||
InterpolateSpecificParams specificParams;
|
||||
ShapeParams shapeParams;
|
||||
ElementType prec;
|
||||
std::map<std::string, std::string> additionalConfig;
|
||||
std::tie(specificParams, shapeParams, prec) = obj.param;
|
||||
|
||||
ngraph::op::v4::Interpolate::InterpolateMode mode;
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode transfMode;
|
||||
ngraph::op::v4::Interpolate::NearestMode nearMode;
|
||||
bool antiAlias;
|
||||
std::vector<size_t> padBegin;
|
||||
std::vector<size_t> padEnd;
|
||||
double cubeCoef;
|
||||
std::tie(mode, transfMode, nearMode, antiAlias, padBegin, padEnd, cubeCoef) = specificParams;
|
||||
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode shapeCalcMode;
|
||||
InputShape inputShapes;
|
||||
ngraph::helpers::InputLayerType shapeInputType;
|
||||
std::vector<std::vector<float>> shapeDataForInput;
|
||||
std::vector<int64_t> axes;
|
||||
std::tie(shapeCalcMode, inputShapes, shapeInputType, shapeDataForInput, axes) = shapeParams;
|
||||
|
||||
std::ostringstream result;
|
||||
result << "ShapeCalcMode=" << shapeCalcMode << "_";
|
||||
result << "IS=";
|
||||
result << CommonTestUtils::partialShape2str({inputShapes.first}) << "_";
|
||||
result << "TS=";
|
||||
for (const auto& shape : inputShapes.second) {
|
||||
result << CommonTestUtils::vec2str(shape) << "_";
|
||||
}
|
||||
if (shapeCalcMode == ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES) {
|
||||
result << "Scales=";
|
||||
} else {
|
||||
result << "Sizes=";
|
||||
}
|
||||
for (const auto &data : shapeDataForInput) {
|
||||
result << CommonTestUtils::vec2str(data) << "_";
|
||||
}
|
||||
result << shapeInputType << "_";
|
||||
result << "InterpolateMode=" << mode << "_";
|
||||
result << "CoordinateTransformMode=" << transfMode << "_";
|
||||
result << "NearestMode=" << nearMode << "_";
|
||||
result << "CubeCoef=" << cubeCoef << "_";
|
||||
result << "Antialias=" << antiAlias << "_";
|
||||
result << "PB=" << CommonTestUtils::vec2str(padBegin) << "_";
|
||||
result << "PE=" << CommonTestUtils::vec2str(padEnd) << "_";
|
||||
result << "Axes=" << CommonTestUtils::vec2str(axes) << "_";
|
||||
result << "PRC=" << prec << "_";
|
||||
|
||||
if (!additionalConfig.empty()) {
|
||||
result << "_PluginConf";
|
||||
for (auto& item : additionalConfig) {
|
||||
result << "_" << item.first << "=" << item.second;
|
||||
}
|
||||
}
|
||||
|
||||
return result.str();
|
||||
}
|
||||
|
||||
void generate_inputs(const std::vector<ngraph::Shape>& targetInputStaticShapes) override {
|
||||
inputs.clear();
|
||||
const auto& funcInputs = function->inputs();
|
||||
for (int i = 0; i < funcInputs.size(); ++i) {
|
||||
const auto& funcInput = funcInputs[i];
|
||||
ov::Tensor tensor;
|
||||
|
||||
if (i == 1) {
|
||||
if (shapeCalcMode == ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES) {
|
||||
tensor = ov::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i], sizes[inferRequestNum].data());
|
||||
} else {
|
||||
tensor = ov::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i], scales[inferRequestNum].data());
|
||||
}
|
||||
} else {
|
||||
tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), targetInputStaticShapes[i], 2560, 0, 256);
|
||||
}
|
||||
|
||||
inputs.insert({funcInput.get_node_shared_ptr(), tensor});
|
||||
}
|
||||
inferRequestNum++;
|
||||
}
|
||||
|
||||
void configure_model() override {
|
||||
ov::preprocess::PrePostProcessor p(function);
|
||||
{
|
||||
auto& params = function->get_parameters();
|
||||
for (size_t i = 0; i < params.size(); i++) {
|
||||
if (i > 0) {
|
||||
continue;
|
||||
}
|
||||
if (inType != ov::element::Type_t::undefined) {
|
||||
p.input(i).tensor().set_element_type(inType);
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
auto results = function->get_results();
|
||||
for (size_t i = 0; i < results.size(); i++) {
|
||||
if (outType != ov::element::Type_t::undefined) {
|
||||
p.output(i).tensor().set_element_type(outType);
|
||||
}
|
||||
}
|
||||
}
|
||||
function = p.build();
|
||||
}
|
||||
|
||||
protected:
|
||||
std::vector<std::vector<float>> scales;
|
||||
std::vector<std::vector<int32_t>> sizes;
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode shapeCalcMode;
|
||||
size_t inferRequestNum = 0;
|
||||
|
||||
void SetUp() override {
|
||||
targetDevice = CommonTestUtils::DEVICE_GPU;
|
||||
|
||||
InterpolateSpecificParams specificParams;
|
||||
ShapeParams shapeParams;
|
||||
ElementType ngPrc;
|
||||
std::tie(specificParams, shapeParams, ngPrc) = this->GetParam();
|
||||
|
||||
ngraph::op::v4::Interpolate::InterpolateMode mode;
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode transfMode;
|
||||
ngraph::op::v4::Interpolate::NearestMode nearMode;
|
||||
bool antiAlias;
|
||||
std::vector<size_t> padBegin;
|
||||
std::vector<size_t> padEnd;
|
||||
double cubeCoef;
|
||||
std::tie(mode, transfMode, nearMode, antiAlias, padBegin, padEnd, cubeCoef) = specificParams;
|
||||
|
||||
InputShape dataShape;
|
||||
ngraph::helpers::InputLayerType shapeInputType;
|
||||
std::vector<std::vector<float>> shapeDataForInput;
|
||||
std::vector<int64_t> axes;
|
||||
std::tie(shapeCalcMode, dataShape, shapeInputType, shapeDataForInput, axes) = shapeParams;
|
||||
|
||||
if (shapeCalcMode == ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES) {
|
||||
scales = shapeDataForInput;
|
||||
sizes.resize(scales.size(), std::vector<int32_t>(scales.front().size(), 0));
|
||||
} else {
|
||||
sizes.resize(shapeDataForInput.size());
|
||||
for (size_t i = 0; i < shapeDataForInput.size(); i++) {
|
||||
for (size_t j = 0; j < shapeDataForInput[i].size(); j++) {
|
||||
sizes[i].push_back(shapeDataForInput[i][j]);
|
||||
}
|
||||
}
|
||||
scales.resize(sizes.size(), std::vector<float>(sizes.front().size(), 0));
|
||||
}
|
||||
|
||||
std::vector<InputShape> inputShapes;
|
||||
inputShapes.push_back(dataShape);
|
||||
if (shapeInputType == ngraph::helpers::InputLayerType::PARAMETER) {
|
||||
inputShapes.push_back(InputShape({static_cast<int64_t>(axes.size())}, std::vector<ov::Shape>(dataShape.second.size(), {axes.size()})));
|
||||
}
|
||||
|
||||
init_input_shapes(inputShapes);
|
||||
|
||||
auto params = ngraph::builder::makeDynamicParams(ngPrc, {inputDynamicShapes.front()});
|
||||
|
||||
std::shared_ptr<ov::Node> sizesInput, scalesInput;
|
||||
if (shapeCalcMode == ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES) {
|
||||
if (shapeInputType == ngraph::helpers::InputLayerType::PARAMETER) {
|
||||
auto paramNode = std::make_shared<ngraph::opset3::Parameter>(ngraph::element::Type_t::f32, ov::Shape{scales.front().size()});
|
||||
params.push_back(paramNode);
|
||||
scalesInput = paramNode;
|
||||
} else {
|
||||
scalesInput = std::make_shared<ngraph::opset3::Constant>(ngraph::element::Type_t::f32, ov::Shape{scales.front().size()}, scales.front());
|
||||
}
|
||||
sizesInput = std::make_shared<ngraph::opset3::Constant>(ngraph::element::Type_t::i32, ov::Shape{sizes.front().size()}, sizes.front());
|
||||
} else {
|
||||
if (shapeInputType == ngraph::helpers::InputLayerType::PARAMETER) {
|
||||
auto paramNode = std::make_shared<ngraph::opset3::Parameter>(ngraph::element::Type_t::i32, ov::Shape{sizes.front().size()});
|
||||
params.push_back(paramNode);
|
||||
sizesInput = paramNode;
|
||||
} else {
|
||||
sizesInput = std::make_shared<ngraph::opset3::Constant>(ngraph::element::Type_t::i32, ov::Shape{sizes.front().size()}, sizes.front());
|
||||
}
|
||||
scalesInput = std::make_shared<ngraph::opset3::Constant>(ngraph::element::Type_t::f32, ov::Shape{scales.front().size()}, scales.front());
|
||||
}
|
||||
auto axesInput = std::make_shared<ngraph::opset3::Constant>(ngraph::element::Type_t::i64, ov::Shape{axes.size()}, axes);
|
||||
|
||||
for (size_t i = 0; i < params.size(); i++) {
|
||||
params[i]->set_friendly_name(std::string("param_") + std::to_string(i));
|
||||
}
|
||||
|
||||
ngraph::op::v4::Interpolate::InterpolateAttrs interpAttr{mode, shapeCalcMode, padBegin, padEnd, transfMode, nearMode,
|
||||
antiAlias, cubeCoef};
|
||||
|
||||
auto interpolate = std::make_shared<ngraph::op::v4::Interpolate>(params[0],
|
||||
sizesInput,
|
||||
scalesInput,
|
||||
axesInput,
|
||||
interpAttr);
|
||||
ngraph::ResultVector results;
|
||||
for (int i = 0; i < interpolate->get_output_size(); ++i) {
|
||||
results.push_back(std::make_shared<ngraph::opset1::Result>(interpolate->output(i)));
|
||||
}
|
||||
function = std::make_shared<ngraph::Function>(results, params, "InterpolateGPU");
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(InterpolateLayerGPUTest, CompareWithRefs) {
|
||||
SKIP_IF_CURRENT_TEST_IS_DISABLED()
|
||||
run();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
const std::vector<ngraph::op::v4::Interpolate::CoordinateTransformMode> coordinateTransformModes_Smoke = {
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode::HALF_PIXEL,
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode::ASYMMETRIC,
|
||||
};
|
||||
|
||||
const std::vector<ngraph::op::v4::Interpolate::CoordinateTransformMode> coordinateTransformModes_Full = {
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode::TF_HALF_PIXEL_FOR_NN,
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode::PYTORCH_HALF_PIXEL,
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode::HALF_PIXEL,
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode::ASYMMETRIC,
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode::ALIGN_CORNERS,
|
||||
};
|
||||
|
||||
const std::vector<ngraph::op::v4::Interpolate::NearestMode> nearestModes_Smoke = {
|
||||
ngraph::op::v4::Interpolate::NearestMode::SIMPLE,
|
||||
ngraph::op::v4::Interpolate::NearestMode::ROUND_PREFER_FLOOR,
|
||||
ngraph::op::v4::Interpolate::NearestMode::FLOOR,
|
||||
};
|
||||
|
||||
const std::vector<ngraph::op::v4::Interpolate::NearestMode> nearestModes_Full = {
|
||||
ngraph::op::v4::Interpolate::NearestMode::SIMPLE,
|
||||
ngraph::op::v4::Interpolate::NearestMode::ROUND_PREFER_FLOOR,
|
||||
ngraph::op::v4::Interpolate::NearestMode::FLOOR,
|
||||
ngraph::op::v4::Interpolate::NearestMode::CEIL,
|
||||
ngraph::op::v4::Interpolate::NearestMode::ROUND_PREFER_CEIL,
|
||||
};
|
||||
|
||||
const std::vector<ngraph::op::v4::Interpolate::NearestMode> defNearestModes = {
|
||||
ngraph::op::v4::Interpolate::NearestMode::ROUND_PREFER_FLOOR,
|
||||
};
|
||||
|
||||
const std::vector<bool> antialias = {
|
||||
false,
|
||||
};
|
||||
|
||||
const std::vector<double> cubeCoefs = {
|
||||
-0.75f,
|
||||
};
|
||||
|
||||
const std::vector<std::vector<size_t>> pads4D = {
|
||||
{0, 0, 0, 0},
|
||||
{0, 0, 1, 1},
|
||||
};
|
||||
|
||||
const std::vector<std::vector<int64_t>> defaultAxes4D = {
|
||||
{0, 1, 2, 3}
|
||||
};
|
||||
|
||||
const std::vector<ShapeParams> shapeParams4D_Smoke = {
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
||||
InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}, {2, 7, 6, 5}, {1, 11, 4, 4}}},
|
||||
ngraph::helpers::InputLayerType::PARAMETER,
|
||||
{{1.f, 1.f, 1.25f, 1.5f}, {1.f, 1.f, 1.25f, 1.25f}, {1.f, 1.f, 1.25f, 1.5f}},
|
||||
defaultAxes4D.front()
|
||||
},
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
||||
InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}, {2, 7, 6, 5}, {1, 11, 4, 4}}},
|
||||
ngraph::helpers::InputLayerType::PARAMETER,
|
||||
{{1, 11, 5, 6}, {2, 7, 8, 7}, {1, 11, 5, 6}},
|
||||
defaultAxes4D.front()
|
||||
}
|
||||
};
|
||||
|
||||
const std::vector<ShapeParams> shapeParams4D_Full = {
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
||||
InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}, {2, 7, 6, 5}, {1, 11, 4, 4}}},
|
||||
ngraph::helpers::InputLayerType::CONSTANT,
|
||||
{{1.f, 1.f, 1.25f, 1.5f}},
|
||||
defaultAxes4D.front()
|
||||
},
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
||||
InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}}},
|
||||
ngraph::helpers::InputLayerType::CONSTANT,
|
||||
{{1, 11, 5, 6}},
|
||||
defaultAxes4D.front()
|
||||
}
|
||||
};
|
||||
|
||||
const auto interpolateCasesNN_Smoke = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest),
|
||||
::testing::ValuesIn(coordinateTransformModes_Smoke),
|
||||
::testing::ValuesIn(nearestModes_Smoke),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
const auto interpolateCasesNN_Full = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest),
|
||||
::testing::ValuesIn(coordinateTransformModes_Full),
|
||||
::testing::ValuesIn(nearestModes_Full),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateNN_Layout_Test, InterpolateLayerGPUTest,
|
||||
::testing::Combine(
|
||||
interpolateCasesNN_Smoke,
|
||||
::testing::ValuesIn(shapeParams4D_Smoke),
|
||||
::testing::Values(ElementType::f32)),
|
||||
InterpolateLayerGPUTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(InterpolateNN_Layout_Test, InterpolateLayerGPUTest,
|
||||
::testing::Combine(
|
||||
interpolateCasesNN_Full,
|
||||
::testing::ValuesIn(shapeParams4D_Full),
|
||||
::testing::Values(ElementType::f32)),
|
||||
InterpolateLayerGPUTest::getTestCaseName);
|
||||
|
||||
const auto interpolateCasesLinearOnnx_Smoke = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear_onnx),
|
||||
::testing::ValuesIn(coordinateTransformModes_Smoke),
|
||||
::testing::ValuesIn(defNearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
const auto interpolateCasesLinearOnnx_Full = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear_onnx),
|
||||
::testing::ValuesIn(coordinateTransformModes_Full),
|
||||
::testing::ValuesIn(defNearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateLinearOnnx_Layout_Test, InterpolateLayerGPUTest,
|
||||
::testing::Combine(
|
||||
interpolateCasesLinearOnnx_Smoke,
|
||||
::testing::ValuesIn(shapeParams4D_Smoke),
|
||||
::testing::Values(ElementType::f32)),
|
||||
InterpolateLayerGPUTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(InterpolateLinearOnnx_Layout_Test, InterpolateLayerGPUTest,
|
||||
::testing::Combine(
|
||||
interpolateCasesLinearOnnx_Full,
|
||||
::testing::ValuesIn(shapeParams4D_Full),
|
||||
::testing::Values(ElementType::f32)),
|
||||
InterpolateLayerGPUTest::getTestCaseName);
|
||||
|
||||
const auto interpolateCasesLinear_Smoke = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear),
|
||||
::testing::ValuesIn(coordinateTransformModes_Smoke),
|
||||
::testing::ValuesIn(defNearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
const auto interpolateCasesLinear_Full = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear),
|
||||
::testing::ValuesIn(coordinateTransformModes_Full),
|
||||
::testing::ValuesIn(defNearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateLinear_Layout_Test, InterpolateLayerGPUTest,
|
||||
::testing::Combine(
|
||||
interpolateCasesLinear_Smoke,
|
||||
::testing::ValuesIn(shapeParams4D_Smoke),
|
||||
::testing::Values(ElementType::f32)),
|
||||
InterpolateLayerGPUTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(InterpolateLinear_Layout_Test, InterpolateLayerGPUTest,
|
||||
::testing::Combine(
|
||||
interpolateCasesLinear_Full,
|
||||
::testing::ValuesIn(shapeParams4D_Full),
|
||||
::testing::Values(ElementType::f32)),
|
||||
InterpolateLayerGPUTest::getTestCaseName);
|
||||
|
||||
const auto interpolateCasesCubic_Smoke = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::cubic),
|
||||
::testing::ValuesIn(coordinateTransformModes_Smoke),
|
||||
::testing::ValuesIn(defNearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
const auto interpolateCasesCubic_Full = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::cubic),
|
||||
::testing::ValuesIn(coordinateTransformModes_Full),
|
||||
::testing::ValuesIn(defNearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateCubic_Layout_Test, InterpolateLayerGPUTest,
|
||||
::testing::Combine(
|
||||
interpolateCasesCubic_Smoke,
|
||||
::testing::ValuesIn(shapeParams4D_Smoke),
|
||||
::testing::Values(ElementType::f32)),
|
||||
InterpolateLayerGPUTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(InterpolateCubic_Layout_Test, InterpolateLayerGPUTest,
|
||||
::testing::Combine(
|
||||
interpolateCasesCubic_Full,
|
||||
::testing::ValuesIn(shapeParams4D_Full),
|
||||
::testing::Values(ElementType::f32)),
|
||||
InterpolateLayerGPUTest::getTestCaseName);
|
||||
|
||||
////////////////////////5D/////////////////////////////
|
||||
|
||||
const std::vector<std::vector<size_t>> pads5D = {
|
||||
{0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
const std::vector<std::vector<int64_t>> defaultAxes5D = {
|
||||
{0, 1, 2, 3, 4}
|
||||
};
|
||||
|
||||
const std::vector<ShapeParams> shapeParams5D_Smoke = {
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
||||
InputShape{{-1, {2, 20}, -1, -1, -1}, {{1, 11, 4, 4, 4}, {2, 7, 6, 5, 8}, {1, 11, 4, 4, 4}}},
|
||||
ngraph::helpers::InputLayerType::PARAMETER,
|
||||
{{1.f, 1.f, 1.25f, 1.5f, 0.5f}, {1.f, 1.f, 1.25f, 1.25f, 1.25f}, {1.f, 1.f, 1.25f, 1.5f, 0.5f}},
|
||||
defaultAxes5D.front()
|
||||
},
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
||||
InputShape{{-1, {2, 20}, -1, -1, -1}, {{1, 11, 4, 4, 4}, {2, 7, 6, 5, 8}, {1, 11, 4, 4, 4}}},
|
||||
ngraph::helpers::InputLayerType::PARAMETER,
|
||||
{{1, 11, 5, 6, 2}, {2, 7, 8, 7, 4}, {1, 11, 5, 6, 2}},
|
||||
defaultAxes5D.front()
|
||||
},
|
||||
};
|
||||
|
||||
const std::vector<ShapeParams> shapeParams5D_Full = {
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
||||
InputShape{{-1, {2, 20}, -1, -1, -1}, {{1, 11, 4, 4, 4}, {2, 7, 6, 5, 8}, {1, 11, 4, 4, 4}}},
|
||||
ngraph::helpers::InputLayerType::CONSTANT,
|
||||
{{1.f, 1.f, 1.25f, 1.5f, 0.5f}},
|
||||
defaultAxes5D.front()
|
||||
},
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
||||
InputShape{{-1, {2, 20}, -1, -1, -1}, {{1, 11, 4, 4, 4}, {1, 11, 5, 5, 8}, {1, 11, 4, 4, 4}}},
|
||||
ngraph::helpers::InputLayerType::CONSTANT,
|
||||
{{1, 11, 5, 6, 4}},
|
||||
defaultAxes5D.front()
|
||||
}
|
||||
};
|
||||
|
||||
const auto interpolateCasesLinearOnnx5D_Smoke = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear_onnx),
|
||||
::testing::ValuesIn(coordinateTransformModes_Smoke),
|
||||
::testing::ValuesIn(defNearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads5D),
|
||||
::testing::ValuesIn(pads5D),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
const auto interpolateCasesLinearOnnx5D_Full = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear_onnx),
|
||||
::testing::ValuesIn(coordinateTransformModes_Full),
|
||||
::testing::ValuesIn(defNearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads5D),
|
||||
::testing::ValuesIn(pads5D),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateLinearOnnx5D_Layout_Test, InterpolateLayerGPUTest,
|
||||
::testing::Combine(
|
||||
interpolateCasesLinearOnnx5D_Smoke,
|
||||
::testing::ValuesIn(shapeParams5D_Smoke),
|
||||
::testing::Values(ElementType::f32)),
|
||||
InterpolateLayerGPUTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(InterpolateLinearOnnx5D_Layout_Test, InterpolateLayerGPUTest,
|
||||
::testing::Combine(
|
||||
interpolateCasesLinearOnnx5D_Full,
|
||||
::testing::ValuesIn(shapeParams5D_Full),
|
||||
::testing::Values(ElementType::f32)),
|
||||
InterpolateLayerGPUTest::getTestCaseName);
|
||||
|
||||
const auto interpolateCasesNN5D_Smoke = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest),
|
||||
::testing::ValuesIn(coordinateTransformModes_Smoke),
|
||||
::testing::ValuesIn(nearestModes_Smoke),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads5D),
|
||||
::testing::ValuesIn(pads5D),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
const auto interpolateCasesNN5D_Full = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest),
|
||||
::testing::ValuesIn(coordinateTransformModes_Full),
|
||||
::testing::ValuesIn(nearestModes_Full),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads5D),
|
||||
::testing::ValuesIn(pads5D),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateNN5D_Layout_Test, InterpolateLayerGPUTest,
|
||||
::testing::Combine(
|
||||
interpolateCasesNN5D_Smoke,
|
||||
::testing::ValuesIn(shapeParams5D_Smoke),
|
||||
::testing::Values(ElementType::f32)),
|
||||
InterpolateLayerGPUTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(InterpolateNN5D_Layout_Test, InterpolateLayerGPUTest,
|
||||
::testing::Combine(
|
||||
interpolateCasesNN5D_Full,
|
||||
::testing::ValuesIn(shapeParams5D_Full),
|
||||
::testing::Values(ElementType::f32)),
|
||||
InterpolateLayerGPUTest::getTestCaseName);
|
||||
|
||||
} // namespace
|
||||
|
||||
} // namespace GPULayerTestsDefinitions
|
@ -0,0 +1,328 @@
|
||||
// Copyright (C) 2022 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include <shared_test_classes/single_layer/mvn.hpp>
|
||||
#include "ngraph_functions/builders.hpp"
|
||||
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||
|
||||
using namespace InferenceEngine;
|
||||
using namespace ov::test;
|
||||
|
||||
namespace GPULayerTestsDefinitions {
|
||||
|
||||
using basicGPUMvnParams = std::tuple<
|
||||
InputShape, // Input shapes
|
||||
ElementType, // Input precision
|
||||
ngraph::AxisSet, // Reduction axes
|
||||
bool, // Across channels
|
||||
bool, // Normalize variance
|
||||
double>; // Epsilon
|
||||
|
||||
using MvnLayerGPUTestParamSet = std::tuple<
|
||||
basicGPUMvnParams,
|
||||
ElementType, // CNNNetwork input precision
|
||||
ElementType>; // CNNNetwork output precision
|
||||
|
||||
class MvnLayerGPUTest : public testing::WithParamInterface<MvnLayerGPUTestParamSet>,
|
||||
virtual public SubgraphBaseTest {
|
||||
public:
|
||||
static std::string getTestCaseName(testing::TestParamInfo<MvnLayerGPUTestParamSet> obj) {
|
||||
basicGPUMvnParams basicParamsSet;
|
||||
ElementType inputPrecision, outputPrecision;
|
||||
std::tie(basicParamsSet, inputPrecision, outputPrecision) = obj.param;
|
||||
|
||||
InputShape inputShapes;
|
||||
ElementType netPrecision;
|
||||
ngraph::AxisSet axes;
|
||||
bool acrossChanels, normalizeVariance;
|
||||
double eps;
|
||||
std::tie(inputShapes, netPrecision, axes, acrossChanels, normalizeVariance, eps) = basicParamsSet;
|
||||
|
||||
std::ostringstream result;
|
||||
result << "IS=" << CommonTestUtils::partialShape2str({inputShapes.first}) << "_";
|
||||
result << "TS=";
|
||||
for (const auto& shape : inputShapes.second) {
|
||||
result << "(" << CommonTestUtils::vec2str(shape) << ")_";
|
||||
}
|
||||
result << "Precision=" << netPrecision << "_";
|
||||
if (!axes.empty()) {
|
||||
result << "ReductionAccess=" << CommonTestUtils::vec2str(axes.to_vector()) << "_";
|
||||
} else {
|
||||
result << "AcrossChannels=" << (acrossChanels ? "TRUE" : "FALSE") << "_";
|
||||
}
|
||||
result << "NormalizeVariance=" << (normalizeVariance ? "TRUE" : "FALSE") << "_";
|
||||
result << "Epsilon=" << eps;
|
||||
result << "_" << "CNNInpPrc=" << inputPrecision;
|
||||
result << "_" << "CNNOutPrc=" << outputPrecision;
|
||||
|
||||
return result.str();
|
||||
}
|
||||
protected:
|
||||
void SetUp() override {
|
||||
targetDevice = CommonTestUtils::DEVICE_GPU;
|
||||
|
||||
basicGPUMvnParams basicParamsSet;
|
||||
ElementType inPrc;
|
||||
ElementType outPrc;
|
||||
std::tie(basicParamsSet, inPrc, outPrc) = this->GetParam();
|
||||
|
||||
InputShape inputShapes;
|
||||
ElementType netPrecision;
|
||||
ngraph::AxisSet axes;
|
||||
bool acrossChanels, normalizeVariance;
|
||||
double eps;
|
||||
std::tie(inputShapes, netPrecision, axes, acrossChanels, normalizeVariance, eps) = basicParamsSet;
|
||||
|
||||
init_input_shapes({inputShapes});
|
||||
|
||||
auto param = ngraph::builder::makeDynamicParams(netPrecision, inputDynamicShapes);
|
||||
auto paramOuts = ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes<ngraph::op::Parameter>(param));
|
||||
auto mvn = ngraph::builder::makeMVN(paramOuts[0], acrossChanels, normalizeVariance, eps);
|
||||
if (!axes.empty()) {
|
||||
mvn = ngraph::builder::makeMVN(paramOuts[0], axes, normalizeVariance, eps);
|
||||
}
|
||||
|
||||
rel_threshold = 0.015f;
|
||||
|
||||
ngraph::ResultVector results;
|
||||
for (int i = 0; i < mvn->get_output_size(); ++i) {
|
||||
results.push_back(std::make_shared<ngraph::opset1::Result>(mvn->output(i)));
|
||||
}
|
||||
function = std::make_shared<ngraph::Function>(results, param, "Pad");
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(MvnLayerGPUTest, CompareWithRefs) {
|
||||
SKIP_IF_CURRENT_TEST_IS_DISABLED()
|
||||
run();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
const std::vector<InputShape> inputShapes_1D = {
|
||||
{
|
||||
// dynamic
|
||||
{-1},
|
||||
// target
|
||||
{
|
||||
{2},
|
||||
{16},
|
||||
{1},
|
||||
{2}
|
||||
}
|
||||
},
|
||||
{
|
||||
// dynamic
|
||||
{{1, 20}},
|
||||
// target
|
||||
{
|
||||
{1},
|
||||
{16},
|
||||
{4},
|
||||
{16}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const std::vector<InputShape> inputShapes_2D = {
|
||||
{
|
||||
// dynamic
|
||||
{-1, -1},
|
||||
// target
|
||||
{
|
||||
{2, 16},
|
||||
{4, 16},
|
||||
{1, 16},
|
||||
{4, 16}
|
||||
}
|
||||
},
|
||||
{
|
||||
// dynamic
|
||||
{{1, 5}, {1, 20}},
|
||||
// target
|
||||
{
|
||||
{1, 1},
|
||||
{2, 16},
|
||||
{4, 16},
|
||||
{2, 16}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const std::vector<InputShape> inputShapes_3D = {
|
||||
{
|
||||
// dynamic
|
||||
{-1, -1, -1},
|
||||
// target
|
||||
{
|
||||
{2, 16, 6},
|
||||
{4, 16, 2},
|
||||
{2, 16, 6},
|
||||
{4, 16, 2}
|
||||
}
|
||||
},
|
||||
{
|
||||
// dynamic
|
||||
{{1, 5}, {1, 20}, {1, 7}},
|
||||
// target
|
||||
{
|
||||
{1, 1, 1},
|
||||
{2, 16, 6},
|
||||
{4, 16, 2},
|
||||
{2, 16, 6}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const std::vector<InputShape> inputShapes_4D = {
|
||||
{
|
||||
// dynamic
|
||||
{-1, -1, -1, -1},
|
||||
// target
|
||||
{
|
||||
{2, 16, 10, 6},
|
||||
{4, 16, 2, 2},
|
||||
{2, 16, 10, 6},
|
||||
{4, 16, 2, 2}
|
||||
}
|
||||
},
|
||||
{
|
||||
// dynamic
|
||||
{{1, 5}, {1, 20}, {1, 10}, {1, 7}},
|
||||
// target
|
||||
{
|
||||
{1, 1, 1, 1},
|
||||
{2, 16, 10, 6},
|
||||
{4, 16, 2, 2},
|
||||
{2, 16, 10, 6}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const std::vector<InputShape> inputShapes_5D = {
|
||||
{
|
||||
// dynamic
|
||||
{-1, -1, -1, -1, -1},
|
||||
// target
|
||||
{
|
||||
{2, 16, 5, 10, 6},
|
||||
{4, 16, 7, 2, 2},
|
||||
{2, 16, 5, 10, 6},
|
||||
{4, 16, 7, 2, 2}
|
||||
}
|
||||
},
|
||||
{
|
||||
// dynamic
|
||||
{{1, 5}, {1, 20}, {1, 7}, {1, 10}, {1, 7}},
|
||||
// target
|
||||
{
|
||||
{1, 1, 1, 1, 1},
|
||||
{2, 16, 5, 10, 6},
|
||||
{4, 16, 7, 2, 2},
|
||||
{2, 16, 5, 10, 6}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const std::vector<bool> acrossChannels = {
|
||||
true,
|
||||
false
|
||||
};
|
||||
|
||||
const std::vector<bool> normalizeVariance = {
|
||||
true,
|
||||
false
|
||||
};
|
||||
|
||||
const std::vector<double> epsilon = {
|
||||
0.000000001
|
||||
};
|
||||
|
||||
const std::vector<ngraph::AxisSet> emptyReductionAxes = {{}};
|
||||
|
||||
std::vector<ElementType> inpPrc = {ElementType::i8, ElementType::bf16, ElementType::f32};
|
||||
std::vector<ElementType> outPrc = {ElementType::bf16, ElementType::f32};
|
||||
|
||||
const auto Mvn3D = ::testing::Combine(
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(inputShapes_3D),
|
||||
::testing::Values(ElementType::f32),
|
||||
::testing::ValuesIn(emptyReductionAxes),
|
||||
::testing::ValuesIn(acrossChannels),
|
||||
::testing::ValuesIn(normalizeVariance),
|
||||
::testing::ValuesIn(epsilon)),
|
||||
::testing::ValuesIn(inpPrc),
|
||||
::testing::ValuesIn(outPrc));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_Mvn3D, MvnLayerGPUTest, Mvn3D, MvnLayerGPUTest::getTestCaseName);
|
||||
|
||||
const auto Mvn4D = ::testing::Combine(
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(inputShapes_4D),
|
||||
::testing::Values(ElementType::f32),
|
||||
::testing::ValuesIn(emptyReductionAxes),
|
||||
::testing::ValuesIn(acrossChannels),
|
||||
::testing::ValuesIn(normalizeVariance),
|
||||
::testing::ValuesIn(epsilon)),
|
||||
::testing::ValuesIn(inpPrc),
|
||||
::testing::ValuesIn(outPrc));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_Mvn4D, MvnLayerGPUTest, Mvn4D, MvnLayerGPUTest::getTestCaseName);
|
||||
|
||||
const auto Mvn5D = ::testing::Combine(
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(inputShapes_5D),
|
||||
::testing::Values(ElementType::f32),
|
||||
::testing::ValuesIn(emptyReductionAxes),
|
||||
::testing::ValuesIn(acrossChannels),
|
||||
::testing::ValuesIn(normalizeVariance),
|
||||
::testing::ValuesIn(epsilon)),
|
||||
::testing::ValuesIn(inpPrc),
|
||||
::testing::ValuesIn(outPrc));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_Mvn5D, MvnLayerGPUTest, Mvn5D, MvnLayerGPUTest::getTestCaseName);
|
||||
|
||||
const auto Mvn1D = ::testing::Combine(
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(inputShapes_1D),
|
||||
::testing::Values(ElementType::f32),
|
||||
::testing::ValuesIn(emptyReductionAxes),
|
||||
::testing::ValuesIn(acrossChannels),
|
||||
::testing::ValuesIn(normalizeVariance),
|
||||
::testing::ValuesIn(epsilon)),
|
||||
::testing::ValuesIn(inpPrc),
|
||||
::testing::ValuesIn(outPrc));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_Mvn1D, MvnLayerGPUTest, Mvn1D, MvnLayerGPUTest::getTestCaseName);
|
||||
|
||||
// 2D no transformed
|
||||
const auto Mvn2D = ::testing::Combine(
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(inputShapes_2D),
|
||||
::testing::Values(ElementType::f32),
|
||||
::testing::ValuesIn(emptyReductionAxes),
|
||||
::testing::Values(false),
|
||||
::testing::ValuesIn(normalizeVariance),
|
||||
::testing::ValuesIn(epsilon)),
|
||||
::testing::ValuesIn(inpPrc),
|
||||
::testing::ValuesIn(outPrc));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_Mvn2D, MvnLayerGPUTest, Mvn2D, MvnLayerGPUTest::getTestCaseName);
|
||||
|
||||
// 2d transformed
|
||||
const auto Mvn2DTrans = ::testing::Combine(
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(inputShapes_2D),
|
||||
::testing::Values(ElementType::f32),
|
||||
::testing::ValuesIn(emptyReductionAxes),
|
||||
::testing::Values(true),
|
||||
::testing::ValuesIn(normalizeVariance),
|
||||
::testing::ValuesIn(epsilon)),
|
||||
::testing::ValuesIn(inpPrc),
|
||||
::testing::ValuesIn(outPrc));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_Mvn2DTrans, MvnLayerGPUTest, Mvn2DTrans, MvnLayerGPUTest::getTestCaseName);
|
||||
|
||||
} // namespace
|
||||
} // namespace GPULayerTestsDefinitions
|
@ -0,0 +1,241 @@
|
||||
// Copyright (C) 2022 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include <shared_test_classes/single_layer/pad.hpp>
|
||||
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||
|
||||
using namespace InferenceEngine;
|
||||
using namespace ov;
|
||||
using namespace test;
|
||||
|
||||
namespace GPULayerTestsDefinitions {
|
||||
|
||||
using PadLayerGPUTestParamSet = std::tuple<
|
||||
InputShape, // Input shape
|
||||
ElementType, // Input element type
|
||||
std::vector<int64_t>, // padsBegin
|
||||
std::vector<int64_t>, // padsEnd
|
||||
float, // argPadValue
|
||||
ngraph::helpers::PadMode // padMode
|
||||
>;
|
||||
|
||||
class PadLayerGPUTest : public testing::WithParamInterface<PadLayerGPUTestParamSet>,
|
||||
virtual public SubgraphBaseTest {
|
||||
public:
|
||||
static std::string getTestCaseName(testing::TestParamInfo<PadLayerGPUTestParamSet> obj) {
|
||||
InputShape shapes;
|
||||
ElementType elementType;
|
||||
std::vector<int64_t> padsBegin, padsEnd;
|
||||
ngraph::helpers::PadMode padMode;
|
||||
float argPadValue;
|
||||
std::tie(shapes, elementType, padsBegin, padsEnd, argPadValue, padMode) = obj.param;
|
||||
|
||||
std::ostringstream results;
|
||||
results << "IS=" << CommonTestUtils::partialShape2str({shapes.first}) << "_";
|
||||
results << "TS=";
|
||||
for (const auto& item : shapes.second) {
|
||||
results << CommonTestUtils::vec2str(item) << "_";
|
||||
}
|
||||
results << "Prc=" << elementType << "_";
|
||||
results << "padsBegin=" << CommonTestUtils::vec2str(padsBegin) << "_";
|
||||
results << "padsEnd=" << CommonTestUtils::vec2str(padsEnd) << "_";
|
||||
if (padMode == ngraph::helpers::PadMode::CONSTANT) {
|
||||
results << "Value=" << argPadValue << "_";
|
||||
}
|
||||
results << "PadMode=" << padMode << "_";
|
||||
|
||||
return results.str();
|
||||
}
|
||||
|
||||
protected:
|
||||
void SetUp() override {
|
||||
InputShape shapes;
|
||||
std::vector<int64_t> padsBegin, padsEnd;
|
||||
ngraph::helpers::PadMode padMode;
|
||||
float argPadValue;
|
||||
std::tie(shapes, inType, padsBegin, padsEnd, argPadValue, padMode) = this->GetParam();
|
||||
|
||||
targetDevice = CommonTestUtils::DEVICE_GPU;
|
||||
init_input_shapes({shapes});
|
||||
|
||||
auto params = ngraph::builder::makeDynamicParams(inType, inputDynamicShapes);
|
||||
auto pad = ngraph::builder::makePad(params[0], padsBegin, padsEnd, argPadValue, padMode);
|
||||
|
||||
ngraph::ResultVector results;
|
||||
for (int i = 0; i < pad->get_output_size(); ++i) {
|
||||
results.push_back(std::make_shared<ngraph::opset1::Result>(pad->output(i)));
|
||||
}
|
||||
|
||||
function = std::make_shared<ngraph::Function>(results, params, "Pad");
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(PadLayerGPUTest, CompareWithRefs) {
|
||||
SKIP_IF_CURRENT_TEST_IS_DISABLED()
|
||||
run();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
const std::vector<ElementType> inputPrecisions = {
|
||||
ElementType::f32,
|
||||
ElementType::i8
|
||||
};
|
||||
|
||||
const std::vector<float> argPadValue = {0.f, 2.5f, -1.f};
|
||||
|
||||
const std::vector<ngraph::helpers::PadMode> padMode = {
|
||||
ngraph::helpers::PadMode::EDGE,
|
||||
ngraph::helpers::PadMode::REFLECT,
|
||||
ngraph::helpers::PadMode::SYMMETRIC
|
||||
};
|
||||
|
||||
/* *======================* Dynamic Shapes Tests 4D *======================* */
|
||||
|
||||
const std::vector<InputShape> inputShapesDynamic4D = {
|
||||
{{-1, -1, -1, -1}, // dynamic
|
||||
{{5, 36, 5, 5}, {3, 16, 10, 5}, {3, 24, 10, 10}}}, // target
|
||||
|
||||
{{-1, 32, -1, -1}, // dynamic
|
||||
{{5, 32, 5, 5}, {5, 32, 5, 8}, {3, 32, 8, 8}}}, // target
|
||||
|
||||
{{{1, 5}, {16, 32}, {1, 16}, {1, 16}}, // dynamic
|
||||
{{3, 16, 5, 5}, {5, 24, 5, 8}, {3, 32, 8, 8}}}, // target
|
||||
};
|
||||
|
||||
const std::vector<std::vector<int64_t>> padsBegin4D_Smoke = {{0, 1, 1, 1}, {0, 2, 1, 0}};
|
||||
const std::vector<std::vector<int64_t>> padsEnd4D_Smoke = {{0, 2, 1, 1}, {0, 0, 2, 0}};
|
||||
|
||||
const std::vector<std::vector<int64_t>> padsBegin4D_Full = {{0, 0, 0, 0}, {0, 1, 1, 1}, {0, 2, 1, 0}, {0, 0, 0, 1}};
|
||||
const std::vector<std::vector<int64_t>> padsEnd4D_Full = {{0, 0, 0, 0}, {0, 2, 1, 1}, {0, 0, 2, 0}, {1, 1, 0, 0}};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_GPUPadDynamic4DConst,
|
||||
PadLayerGPUTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(inputShapesDynamic4D),
|
||||
::testing::ValuesIn(inputPrecisions),
|
||||
::testing::ValuesIn(padsBegin4D_Smoke),
|
||||
::testing::ValuesIn(padsEnd4D_Smoke),
|
||||
::testing::ValuesIn(argPadValue),
|
||||
::testing::Values(ngraph::helpers::PadMode::CONSTANT)),
|
||||
PadLayerGPUTest::getTestCaseName
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_GPUPadDynamic4D,
|
||||
PadLayerGPUTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(inputShapesDynamic4D),
|
||||
::testing::ValuesIn(inputPrecisions),
|
||||
::testing::ValuesIn(padsBegin4D_Smoke),
|
||||
::testing::ValuesIn(padsEnd4D_Smoke),
|
||||
::testing::Values(0),
|
||||
::testing::ValuesIn(padMode)),
|
||||
PadLayerGPUTest::getTestCaseName
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
GPUPadDynamic4DConst,
|
||||
PadLayerGPUTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(inputShapesDynamic4D),
|
||||
::testing::ValuesIn(inputPrecisions),
|
||||
::testing::ValuesIn(padsBegin4D_Full),
|
||||
::testing::ValuesIn(padsEnd4D_Full),
|
||||
::testing::ValuesIn(argPadValue),
|
||||
::testing::Values(ngraph::helpers::PadMode::CONSTANT)),
|
||||
PadLayerGPUTest::getTestCaseName
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
GPUPadDynamic4D,
|
||||
PadLayerGPUTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(inputShapesDynamic4D),
|
||||
::testing::ValuesIn(inputPrecisions),
|
||||
::testing::ValuesIn(padsBegin4D_Full),
|
||||
::testing::ValuesIn(padsEnd4D_Full),
|
||||
::testing::Values(0),
|
||||
::testing::ValuesIn(padMode)),
|
||||
PadLayerGPUTest::getTestCaseName
|
||||
);
|
||||
|
||||
/* *======================* *=====================* *======================* */
|
||||
|
||||
/* *======================* Dynamic Shapes Tests 5D *======================* */
|
||||
|
||||
const std::vector<InputShape> inputShapesDynamic5D = {
|
||||
{{-1, -1, -1, -1, -1}, // dynamic
|
||||
{{5, 36, 5, 5, 5}, {3, 16, 8, 5, 7}, {3, 24, 10, 10, 10}}}, // target
|
||||
|
||||
{{-1, 32, -1, -1, -1}, // dynamic
|
||||
{{5, 32, 5, 5, 5}, {3, 32, 8, 5, 7}, {3, 32, 10, 10, 10}}}, // target
|
||||
|
||||
{{{1, 5}, {16, 32}, {1, 16}, {1, 16}, {1, 16}}, // dynamic
|
||||
{{3, 16, 5, 5, 5}, {3, 24, 8, 5, 7}, {4, 32, 10, 10, 10}}}, // target
|
||||
};
|
||||
|
||||
const std::vector<std::vector<int64_t>> padsBegin5D_Smoke = {{0, 0, 2, 0, 0}, {1, 1, 1, 1, 0}};
|
||||
const std::vector<std::vector<int64_t>> padsEnd5D_Smoke = {{0, 0, 1, 0, 0}, {1, 0, 1, 1, 2}};
|
||||
|
||||
const std::vector<std::vector<int64_t>> padsBegin5D_Full = {{0, 0, 0, 0, 0}, {0, 0, 2, 0, 0}, {1, 1, 1, 1, 0}, {2, 0, 1, 0, 1}, {0, 2, 1, 3, 1}};
|
||||
const std::vector<std::vector<int64_t>> padsEnd5D_Full = {{0, 0, 0, 0, 0}, {0, 0, 1, 0, 0}, {1, 0, 1, 1, 2}, {2, 2, 0, 1, 0}, {1, 1, 2, 0, 1}};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_GPUPadDynamic5DConst,
|
||||
PadLayerGPUTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(inputShapesDynamic5D),
|
||||
::testing::ValuesIn(inputPrecisions),
|
||||
::testing::ValuesIn(padsBegin5D_Smoke),
|
||||
::testing::ValuesIn(padsEnd5D_Smoke),
|
||||
::testing::ValuesIn(argPadValue),
|
||||
::testing::Values(ngraph::helpers::PadMode::CONSTANT)),
|
||||
PadLayerGPUTest::getTestCaseName
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_GPUPadDynamic5D,
|
||||
PadLayerGPUTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(inputShapesDynamic5D),
|
||||
::testing::ValuesIn(inputPrecisions),
|
||||
::testing::ValuesIn(padsBegin5D_Smoke),
|
||||
::testing::ValuesIn(padsEnd5D_Smoke),
|
||||
::testing::Values(0),
|
||||
::testing::ValuesIn(padMode)),
|
||||
PadLayerGPUTest::getTestCaseName
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
GPUPadDynamic5DConst,
|
||||
PadLayerGPUTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(inputShapesDynamic5D),
|
||||
::testing::ValuesIn(inputPrecisions),
|
||||
::testing::ValuesIn(padsBegin5D_Full),
|
||||
::testing::ValuesIn(padsEnd5D_Full),
|
||||
::testing::ValuesIn(argPadValue),
|
||||
::testing::Values(ngraph::helpers::PadMode::CONSTANT)),
|
||||
PadLayerGPUTest::getTestCaseName
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
GPUPadDynamic5D,
|
||||
PadLayerGPUTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(inputShapesDynamic5D),
|
||||
::testing::ValuesIn(inputPrecisions),
|
||||
::testing::ValuesIn(padsBegin5D_Full),
|
||||
::testing::ValuesIn(padsEnd5D_Full),
|
||||
::testing::Values(0),
|
||||
::testing::ValuesIn(padMode)),
|
||||
PadLayerGPUTest::getTestCaseName
|
||||
);
|
||||
|
||||
/* *======================* *=====================* *======================* */
|
||||
|
||||
} // namespace
|
||||
} // namespace GPULayerTestsDefinitions
|
Loading…
Reference in New Issue
Block a user