[ONNX] Extend ONNX importer with Round-5 (#2749)
This commit is contained in:
parent
a6520995fe
commit
8b6f61e688
@ -30,26 +30,10 @@ namespace ngraph
|
|||||||
{
|
{
|
||||||
namespace set_1
|
namespace set_1
|
||||||
{
|
{
|
||||||
// WARNING!
|
|
||||||
// Current version is:
|
|
||||||
// data_floor = floor(data)
|
|
||||||
// diff = data - data_floor
|
|
||||||
// if(diff < 0.5f)
|
|
||||||
// return data_floor
|
|
||||||
// else
|
|
||||||
// return data_floor + 1.0f
|
|
||||||
//
|
|
||||||
// The correct version should contain condition:
|
|
||||||
// if (diff < 0.5f || (diff == 0.5f && static_cast<int>(data_floor) % 2 == 0))
|
|
||||||
OutputVector round(const Node& node)
|
OutputVector round(const Node& node)
|
||||||
{
|
{
|
||||||
const Output<ngraph::Node> data{node.get_ng_inputs().at(0)};
|
return {std::make_shared<default_opset::Round>(
|
||||||
const auto half_const =
|
node.get_ng_inputs().at(0), default_opset::Round::RoundMode::HALF_TO_EVEN)};
|
||||||
default_opset::Constant::create(data.get_element_type(), {}, {0.5f});
|
|
||||||
|
|
||||||
// Floor(data + 0.5)
|
|
||||||
return {std::make_shared<default_opset::Floor>(
|
|
||||||
std::make_shared<default_opset::Add>(data, half_const))};
|
|
||||||
}
|
}
|
||||||
} // namespace set_1
|
} // namespace set_1
|
||||||
|
|
||||||
|
@ -2369,7 +2369,6 @@ NGRAPH_TEST(${BACKEND_NAME}, onnx_model_round)
|
|||||||
test_case.run();
|
test_case.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// CASES NOT CORRECTLY HANDLED BY CURRENT IMPLEMENTATION OF ROUND
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_round_half_nearest_even)
|
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_round_half_nearest_even)
|
||||||
{
|
{
|
||||||
const auto function = onnx_import::import_onnx_model(
|
const auto function = onnx_import::import_onnx_model(
|
||||||
|
@ -44,9 +44,6 @@ onnx_model_qlinear_matmul_3d
|
|||||||
onnx_model_gatherND_int32
|
onnx_model_gatherND_int32
|
||||||
onnx_model_gatherND_float
|
onnx_model_gatherND_float
|
||||||
|
|
||||||
# Round op doesn't support some specific cases of rounding
|
|
||||||
onnx_model_round_half_nearest_even
|
|
||||||
|
|
||||||
# Result mismatch
|
# Result mismatch
|
||||||
onnx_model_split_equal_parts_default
|
onnx_model_split_equal_parts_default
|
||||||
onnx_model_argmin_no_keepdims
|
onnx_model_argmin_no_keepdims
|
||||||
@ -587,6 +584,10 @@ broadcast_vector_rowwise_int64
|
|||||||
broadcast_scalar_to_matrix_int64
|
broadcast_scalar_to_matrix_int64
|
||||||
abc_int64
|
abc_int64
|
||||||
|
|
||||||
|
# Unsupported primitive of type: Round
|
||||||
|
IE_CPU.onnx_model_round
|
||||||
|
IE_CPU.onnx_model_round_half_nearest_even
|
||||||
|
|
||||||
# Unsupported primitive of type: SigmoidBackprop
|
# Unsupported primitive of type: SigmoidBackprop
|
||||||
sigmoid_bprop_n1c1h4
|
sigmoid_bprop_n1c1h4
|
||||||
|
|
||||||
@ -1476,6 +1477,9 @@ IE_GPU.matmul_3x2_2x3_transpose
|
|||||||
IE_GPU.region_yolo_v2_caffe
|
IE_GPU.region_yolo_v2_caffe
|
||||||
IE_GPU.region_yolo_v3_mxnet
|
IE_GPU.region_yolo_v3_mxnet
|
||||||
|
|
||||||
|
# Detected op not belonging to opset1!
|
||||||
|
IE_GPU.round_int64
|
||||||
|
|
||||||
# Unsupported collapse op with dynamic shape
|
# Unsupported collapse op with dynamic shape
|
||||||
IE_GPU.builder_opset1_collapse_dyn_shape
|
IE_GPU.builder_opset1_collapse_dyn_shape
|
||||||
|
|
||||||
|
@ -111,8 +111,6 @@ INTERPRETER.onnx_model_conv_integer_pads
|
|||||||
INTERPRETER.onnx_model_gatherND_int32
|
INTERPRETER.onnx_model_gatherND_int32
|
||||||
INTERPRETER.onnx_model_gatherND_float
|
INTERPRETER.onnx_model_gatherND_float
|
||||||
|
|
||||||
# Round op doesn't support some specific cases of rounding
|
|
||||||
onnx_model_round_half_nearest_even
|
|
||||||
|
|
||||||
# GRU/RNN/LSTM Sequence: Output values mismatch - seq_lengths not supported
|
# GRU/RNN/LSTM Sequence: Output values mismatch - seq_lengths not supported
|
||||||
onnx_model_lstm_fwd_mixed_seq_const
|
onnx_model_lstm_fwd_mixed_seq_const
|
||||||
|
Loading…
Reference in New Issue
Block a user