[ONNX FE] Implementation of ONNX STFT op (#16461)
This commit is contained in:
parent
e169c7cd38
commit
4403433309
@ -4,75 +4,28 @@
|
||||
|
||||
#include "op/dft.hpp"
|
||||
|
||||
#include "default_opset.hpp"
|
||||
#include "onnx_import/core/null_node.hpp"
|
||||
#include "utils/common.hpp"
|
||||
#include "utils/dft.hpp"
|
||||
|
||||
namespace ngraph {
|
||||
namespace onnx_import {
|
||||
namespace op {
|
||||
namespace set_1 {
|
||||
|
||||
namespace {
|
||||
// For DFT, IDFT, IRDFT cases, if real data are provided (with shape [D_0, D_1, ..., D_{N-1}, 1])
|
||||
// it's needed to fill tensors with zero imaginary part to be aligned with Core ops requirements.
|
||||
bool try_convert_real_to_complex(ov::Output<ov::Node>& data) {
|
||||
if (data.get_partial_shape().rank().is_static()) {
|
||||
const auto length = data.get_partial_shape().rank().get_length();
|
||||
const auto last_axis_pos = length - 1;
|
||||
const auto last_dim = data.get_partial_shape()[last_axis_pos];
|
||||
if (last_dim.is_static() && last_dim.get_length() == 1) {
|
||||
ov::Output<ov::Node> imag_part = default_opset::Constant::create(data.get_element_type(), {}, {0});
|
||||
imag_part =
|
||||
std::make_shared<default_opset::Broadcast>(imag_part, std::make_shared<default_opset::ShapeOf>(data));
|
||||
data = std::make_shared<default_opset::Concat>(OutputVector{data, imag_part}, last_axis_pos);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// [D_0, D_1, ..., D_{N-1}, 2] case, so additional transformations not needed or we are not able to check it during
|
||||
// importing.
|
||||
return false;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
OutputVector dft(const Node& node) {
|
||||
const OutputVector ng_inputs{node.get_ng_inputs()};
|
||||
ov::Output<ov::Node> data = ng_inputs.at(0);
|
||||
const ov::Output<ov::Node> data = ng_inputs.at(0);
|
||||
|
||||
const auto dft_length_provided = ng_inputs.size() > 1 && !ngraph::op::is_null(ng_inputs[1]);
|
||||
const auto axis = node.get_attribute_value<int64_t>("axis", 1);
|
||||
const auto axis_const = default_opset::Constant::create(element::i64, {1}, {axis});
|
||||
const auto inverse = node.get_attribute_value<int64_t>("inverse", 0);
|
||||
const auto onesided = node.get_attribute_value<int64_t>("onesided", 0);
|
||||
|
||||
bool conversion_to_complex_applied = false;
|
||||
if (inverse || !onesided) { // skip for RDFT case
|
||||
conversion_to_complex_applied = try_convert_real_to_complex(data);
|
||||
}
|
||||
|
||||
ov::Output<ov::Node> result;
|
||||
if (inverse) {
|
||||
if (onesided) {
|
||||
result = dft_length_provided ? std::make_shared<default_opset::IRDFT>(data, axis_const, ng_inputs.at(1))
|
||||
: std::make_shared<default_opset::IRDFT>(data, axis_const);
|
||||
if (conversion_to_complex_applied) { // align the output shape with a real numbers representation
|
||||
const auto unsqueeze_axis = default_opset::Constant::create(element::i64, {}, {-1});
|
||||
result = std::make_shared<default_opset::Unsqueeze>(result, unsqueeze_axis);
|
||||
}
|
||||
} else {
|
||||
result = dft_length_provided ? std::make_shared<default_opset::IDFT>(data, axis_const, ng_inputs.at(1))
|
||||
: std::make_shared<default_opset::IDFT>(data, axis_const);
|
||||
}
|
||||
} else {
|
||||
if (onesided) {
|
||||
result = dft_length_provided ? std::make_shared<default_opset::RDFT>(data, axis_const, ng_inputs.at(1))
|
||||
: std::make_shared<default_opset::RDFT>(data, axis_const);
|
||||
} else {
|
||||
result = dft_length_provided ? std::make_shared<default_opset::DFT>(data, axis_const, ng_inputs.at(1))
|
||||
: std::make_shared<default_opset::DFT>(data, axis_const);
|
||||
}
|
||||
}
|
||||
return {result};
|
||||
return {dft::make_dft(data,
|
||||
dft_length_provided ? ng_inputs.at(1) : std::make_shared<NullNode>(),
|
||||
axis,
|
||||
inverse == 1,
|
||||
onesided == 1)};
|
||||
}
|
||||
|
||||
} // namespace set_1
|
||||
|
124
src/frontends/onnx/frontend/src/op/stft.cpp
Normal file
124
src/frontends/onnx/frontend/src/op/stft.cpp
Normal file
@ -0,0 +1,124 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "op/stft.hpp"
|
||||
|
||||
#include "default_opset.hpp"
|
||||
#include "exceptions.hpp"
|
||||
#include "onnx_import/core/null_node.hpp"
|
||||
#include "utils/common.hpp"
|
||||
#include "utils/dft.hpp"
|
||||
|
||||
namespace ngraph {
|
||||
namespace onnx_import {
|
||||
namespace op {
|
||||
namespace set_17 {
|
||||
|
||||
OutputVector stft(const Node& node) {
|
||||
const OutputVector ng_inputs{node.get_ng_inputs()};
|
||||
auto signal = ng_inputs.at(0);
|
||||
const auto dft_length_provided = ng_inputs.size() > 3 && !ngraph::op::is_null(ng_inputs[3]);
|
||||
const auto onesided = node.get_attribute_value<int64_t>("onesided", 1);
|
||||
const int64_t axis = 1;
|
||||
|
||||
const auto& frame_step_node = ng_inputs.at(1);
|
||||
CHECK_VALID_NODE(node,
|
||||
ngraph::op::is_constant(frame_step_node.get_node_shared_ptr()) &&
|
||||
ov::shape_size(frame_step_node.get_shape()) <= 1,
|
||||
"frame_step input must be a scalar or Shape{1} constant.");
|
||||
const auto frame_step =
|
||||
ov::as_type_ptr<default_opset::Constant>(frame_step_node.get_node_shared_ptr())->cast_vector<int64_t>()[0];
|
||||
const auto signal_param_shape = signal.get_partial_shape();
|
||||
CHECK_VALID_NODE(node,
|
||||
signal_param_shape.is_static() && signal_param_shape.size() == 3,
|
||||
"Shape of signal input must be static with the rank equal to 3.");
|
||||
|
||||
int64_t frame_length = signal_param_shape[axis].get_length() / frame_step; // default value
|
||||
if (dft_length_provided) {
|
||||
const auto& frame_length_node = ng_inputs[3];
|
||||
CHECK_VALID_NODE(node,
|
||||
ngraph::op::is_constant(frame_length_node.get_node_shared_ptr()) &&
|
||||
ov::shape_size(frame_length_node.get_shape()) <= 1,
|
||||
"frame_length input must be a scalar or Shape{1} constant.");
|
||||
frame_length = ov::as_type_ptr<default_opset::Constant>(frame_length_node.get_node_shared_ptr())
|
||||
->cast_vector<int64_t>()[0];
|
||||
}
|
||||
|
||||
const auto window_node_provided = ng_inputs.size() > 2 && !ngraph::op::is_null(ng_inputs[2]);
|
||||
if (window_node_provided) { // window input provided
|
||||
if (ng_inputs[2].get_partial_shape().rank().is_static()) {
|
||||
CHECK_VALID_NODE(node,
|
||||
ng_inputs[2].get_partial_shape().rank().get_length() == 1,
|
||||
"The rank of window input must be 1D.");
|
||||
if (ng_inputs[2].get_partial_shape()[0].is_static()) {
|
||||
CHECK_VALID_NODE(node,
|
||||
ng_inputs[2].get_partial_shape()[0].get_length() == frame_length,
|
||||
"The length of window input must be equal to frame_length.");
|
||||
}
|
||||
}
|
||||
}
|
||||
const auto is_complex = [](const ov::Output<ov::Node>& data) {
|
||||
return data.get_partial_shape().rank().is_static() && (data.get_partial_shape().cend() - 1)->is_static() &&
|
||||
(data.get_partial_shape().cend() - 1)->get_length() == 2;
|
||||
};
|
||||
if (onesided == 1) {
|
||||
CHECK_VALID_NODE(node, !is_complex(signal), "If attribute onesided==1, signal input can NOT be complex.");
|
||||
}
|
||||
const int64_t batch_size = signal_param_shape[0].get_length();
|
||||
const auto nstfts = static_cast<int64_t>((signal_param_shape[axis].get_length() - frame_length) / frame_step) + 1;
|
||||
const auto axis_const = default_opset::Constant::create(element::i64, {}, {axis});
|
||||
const auto zero_const = default_opset::Constant::create(element::i64, {}, {0});
|
||||
const auto step = default_opset::Constant::create(element::i64, Shape{2}, {1, 1});
|
||||
ov::OutputVector all_signals;
|
||||
for (int64_t batch = 0; batch < batch_size; ++batch) {
|
||||
ov::OutputVector signals_in_batch;
|
||||
for (int64_t sig_idx = 0; sig_idx < nstfts; ++sig_idx) {
|
||||
const auto start = default_opset::Constant::create(element::i64,
|
||||
Shape{2},
|
||||
std::vector<int64_t>{batch, sig_idx * frame_step});
|
||||
const auto stop =
|
||||
default_opset::Constant::create(element::i64,
|
||||
Shape{2},
|
||||
std::vector<int64_t>{batch + 1, sig_idx * frame_step + frame_length});
|
||||
const auto slice_axes =
|
||||
default_opset::Constant::create(element::i64, Shape{2}, std::vector<int64_t>{0, axis});
|
||||
const auto slice = std::make_shared<default_opset::Slice>(signal, start, stop, step, slice_axes);
|
||||
const ov::Output<ov::Node> flatten_slice = std::make_shared<default_opset::Reshape>(
|
||||
slice,
|
||||
is_complex(slice) ? default_opset::Constant::create(element::i64, {2}, {-1, 2})
|
||||
: (onesided ? default_opset::Constant::create(element::i64, {1}, {-1})
|
||||
: default_opset::Constant::create(element::i64, {2}, {-1, 1})),
|
||||
false);
|
||||
const auto dft = dft::make_dft(
|
||||
window_node_provided
|
||||
? std::make_shared<default_opset::Multiply>(
|
||||
flatten_slice,
|
||||
is_complex(flatten_slice)
|
||||
? std::make_shared<default_opset::Broadcast>( // align window shape with signal shape
|
||||
std::make_shared<default_opset::Unsqueeze>(
|
||||
ng_inputs[2],
|
||||
default_opset::Constant::create(element::i64, {1}, {1})),
|
||||
std::make_shared<default_opset::ShapeOf>(flatten_slice))
|
||||
: ng_inputs[2])
|
||||
: flatten_slice,
|
||||
dft_length_provided ? ng_inputs[3] : std::make_shared<NullNode>(),
|
||||
0,
|
||||
false,
|
||||
onesided == 1);
|
||||
signals_in_batch.push_back(std::make_shared<default_opset::Unsqueeze>(dft, zero_const));
|
||||
}
|
||||
all_signals.push_back(
|
||||
std::make_shared<default_opset::Unsqueeze>(std::make_shared<default_opset::Concat>(signals_in_batch, 0),
|
||||
zero_const));
|
||||
}
|
||||
return {std::make_shared<default_opset::Concat>(all_signals, 0)};
|
||||
}
|
||||
|
||||
} // namespace set_17
|
||||
|
||||
} // namespace op
|
||||
|
||||
} // namespace onnx_import
|
||||
|
||||
} // namespace ngraph
|
22
src/frontends/onnx/frontend/src/op/stft.hpp
Normal file
22
src/frontends/onnx/frontend/src/op/stft.hpp
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright (C) 2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ngraph/node.hpp"
|
||||
#include "onnx_import/core/node.hpp"
|
||||
|
||||
namespace ngraph {
|
||||
namespace onnx_import {
|
||||
namespace op {
|
||||
namespace set_17 {
|
||||
OutputVector stft(const Node& node);
|
||||
|
||||
} // namespace set_17
|
||||
|
||||
} // namespace op
|
||||
|
||||
} // namespace onnx_import
|
||||
|
||||
} // namespace ngraph
|
@ -161,6 +161,7 @@
|
||||
#include "op/split.hpp"
|
||||
#include "op/sqrt.hpp"
|
||||
#include "op/squeeze.hpp"
|
||||
#include "op/stft.hpp"
|
||||
#include "op/sub.hpp"
|
||||
#include "op/sum.hpp"
|
||||
#include "op/tan.hpp"
|
||||
@ -479,6 +480,10 @@ OperatorsBridge::OperatorsBridge() {
|
||||
REGISTER_OPERATOR("SpaceToDepth", 1, space_to_depth);
|
||||
REGISTER_OPERATOR("Split", 1, split);
|
||||
REGISTER_OPERATOR("Split", 13, split);
|
||||
register_operator("STFT",
|
||||
VersionRange::single_version_for_all_opsets(),
|
||||
op::set_17::stft,
|
||||
"frame_step and frame_length inputs must be constants; signal shape must be static;");
|
||||
REGISTER_OPERATOR("Sqrt", 1, sqrt);
|
||||
REGISTER_OPERATOR("Squeeze", 1, squeeze);
|
||||
REGISTER_OPERATOR("Squeeze", 13, squeeze);
|
||||
|
77
src/frontends/onnx/frontend/src/utils/dft.cpp
Normal file
77
src/frontends/onnx/frontend/src/utils/dft.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
// Copyright (C) 2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "dft.hpp"
|
||||
|
||||
#include "default_opset.hpp"
|
||||
#include "onnx_import/core/null_node.hpp"
|
||||
|
||||
using namespace ngraph::onnx_import;
|
||||
|
||||
namespace ngraph {
|
||||
namespace onnx_import {
|
||||
namespace dft {
|
||||
|
||||
namespace {
|
||||
// For DFT, IDFT, IRDFT cases, if real signal are provided (with shape [D_0, D_1, ..., D_{N-1}, 1])
|
||||
// it's needed to fill tensors with zero imaginary part to be aligned with Core ops requirements.
|
||||
bool try_convert_real_to_complex(ov::Output<ov::Node>& signal) {
|
||||
if (signal.get_partial_shape().rank().is_static()) {
|
||||
const auto length = signal.get_partial_shape().rank().get_length();
|
||||
const auto last_axis_pos = length - 1;
|
||||
const auto last_dim = signal.get_partial_shape()[last_axis_pos];
|
||||
if (last_dim.is_static() && last_dim.get_length() == 1) {
|
||||
ov::Output<ov::Node> imag_part = default_opset::Constant::create(signal.get_element_type(), {}, {0});
|
||||
imag_part =
|
||||
std::make_shared<default_opset::Broadcast>(imag_part, std::make_shared<default_opset::ShapeOf>(signal));
|
||||
signal = std::make_shared<default_opset::Concat>(OutputVector{signal, imag_part}, last_axis_pos);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// [D_0, D_1, ..., D_{N-1}, 2] case, so additional transformations not needed or we are not able to check it during
|
||||
// importing.
|
||||
return false;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
ov::Output<ov::Node> make_dft(const ov::Output<ov::Node>& signal,
|
||||
const ov::Output<ov::Node>& length,
|
||||
int64_t axis,
|
||||
bool is_inversed,
|
||||
bool is_onesided) {
|
||||
auto processed_signal = signal;
|
||||
const auto axis_const = default_opset::Constant::create(element::i64, {1}, {axis});
|
||||
bool conversion_to_complex_applied = false;
|
||||
if (is_inversed || !is_onesided) { // skip for RDFT case
|
||||
conversion_to_complex_applied = try_convert_real_to_complex(processed_signal);
|
||||
}
|
||||
bool dft_length_provided = !ngraph::op::is_null(length);
|
||||
|
||||
ov::Output<ov::Node> result;
|
||||
if (is_inversed) {
|
||||
if (is_onesided) {
|
||||
result = dft_length_provided ? std::make_shared<default_opset::IRDFT>(processed_signal, axis_const, length)
|
||||
: std::make_shared<default_opset::IRDFT>(processed_signal, axis_const);
|
||||
if (conversion_to_complex_applied) { // align the output shape with a real numbers representation
|
||||
const auto unsqueeze_axis = default_opset::Constant::create(element::i64, {}, {-1});
|
||||
result = std::make_shared<default_opset::Unsqueeze>(result, unsqueeze_axis);
|
||||
}
|
||||
} else {
|
||||
result = dft_length_provided ? std::make_shared<default_opset::IDFT>(processed_signal, axis_const, length)
|
||||
: std::make_shared<default_opset::IDFT>(processed_signal, axis_const);
|
||||
}
|
||||
} else {
|
||||
if (is_onesided) {
|
||||
result = dft_length_provided ? std::make_shared<default_opset::RDFT>(processed_signal, axis_const, length)
|
||||
: std::make_shared<default_opset::RDFT>(processed_signal, axis_const);
|
||||
} else {
|
||||
result = dft_length_provided ? std::make_shared<default_opset::DFT>(processed_signal, axis_const, length)
|
||||
: std::make_shared<default_opset::DFT>(processed_signal, axis_const);
|
||||
}
|
||||
}
|
||||
return {result};
|
||||
}
|
||||
} // namespace dft
|
||||
} // namespace onnx_import
|
||||
} // namespace ngraph
|
20
src/frontends/onnx/frontend/src/utils/dft.hpp
Normal file
20
src/frontends/onnx/frontend/src/utils/dft.hpp
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "openvino/core/node.hpp"
|
||||
|
||||
namespace ngraph {
|
||||
namespace onnx_import {
|
||||
namespace dft {
|
||||
|
||||
ov::Output<ov::Node> make_dft(const ov::Output<ov::Node>& signal,
|
||||
const ov::Output<ov::Node>& length,
|
||||
int64_t axis,
|
||||
bool is_inversed,
|
||||
bool is_one_sided);
|
||||
} // namespace dft
|
||||
} // namespace onnx_import
|
||||
} // namespace ngraph
|
@ -68,6 +68,7 @@ set(MULTI_TEST_SRC
|
||||
onnx_import_org_pytorch.in.cpp
|
||||
onnx_import_reshape.in.cpp
|
||||
onnx_import_rnn.in.cpp
|
||||
onnx_import_signal.in.cpp
|
||||
onnx_import_quant.in.cpp
|
||||
onnx_test_utils.in.cpp
|
||||
onnx_import_with_editor.in.cpp)
|
||||
|
@ -0,0 +1,99 @@
|
||||
ir_version: 8
|
||||
graph {
|
||||
node {
|
||||
output: "frame_step"
|
||||
name: "frame_step_const"
|
||||
op_type: "Constant"
|
||||
attribute {
|
||||
name: "value"
|
||||
t {
|
||||
dims: 1
|
||||
data_type: 7
|
||||
int64_data: 8
|
||||
name: "frame_step_tensor"
|
||||
}
|
||||
type: TENSOR
|
||||
}
|
||||
}
|
||||
node {
|
||||
output: "frame_length"
|
||||
name: "frame_length_const"
|
||||
op_type: "Constant"
|
||||
attribute {
|
||||
name: "value"
|
||||
t {
|
||||
dims: 1
|
||||
data_type: 7
|
||||
int64_data: 16
|
||||
name: "frame_length_tensor"
|
||||
}
|
||||
type: TENSOR
|
||||
}
|
||||
}
|
||||
node {
|
||||
input: "signal"
|
||||
input: "frame_step"
|
||||
input: "window"
|
||||
input: "frame_length"
|
||||
output: "Y"
|
||||
op_type: "STFT"
|
||||
attribute {
|
||||
name: "onesided"
|
||||
i: 1
|
||||
type: INT
|
||||
}
|
||||
}
|
||||
input {
|
||||
name: "signal"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 2
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
dim_value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
input {
|
||||
name: "window"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 16
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
output {
|
||||
name: "Y"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
opset_import {
|
||||
domain: ""
|
||||
version: 17
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
ir_version: 8
|
||||
graph {
|
||||
node {
|
||||
output: "frame_step"
|
||||
name: "frame_step_const"
|
||||
op_type: "Constant"
|
||||
attribute {
|
||||
name: "value"
|
||||
t {
|
||||
dims: 1
|
||||
data_type: 7
|
||||
int64_data: 4
|
||||
name: "frame_step_tensor"
|
||||
}
|
||||
type: TENSOR
|
||||
}
|
||||
}
|
||||
node {
|
||||
input: "signal"
|
||||
input: "frame_step"
|
||||
input: "window"
|
||||
input: ""
|
||||
output: "Y"
|
||||
op_type: "STFT"
|
||||
attribute {
|
||||
name: "onesided"
|
||||
i: 0
|
||||
type: INT
|
||||
}
|
||||
}
|
||||
input {
|
||||
name: "signal"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 3
|
||||
}
|
||||
dim {
|
||||
dim_value: 32
|
||||
}
|
||||
dim {
|
||||
dim_value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
input {
|
||||
name: "window"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 8
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
output {
|
||||
name: "Y"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
opset_import {
|
||||
domain: ""
|
||||
version: 17
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
ir_version: 8
|
||||
graph {
|
||||
node {
|
||||
output: "frame_step"
|
||||
name: "frame_step_const"
|
||||
op_type: "Constant"
|
||||
attribute {
|
||||
name: "value"
|
||||
t {
|
||||
dims: 1
|
||||
data_type: 7
|
||||
int64_data: 12
|
||||
name: "frame_step_tensor"
|
||||
}
|
||||
type: TENSOR
|
||||
}
|
||||
}
|
||||
node {
|
||||
output: "frame_length"
|
||||
name: "frame_length_const"
|
||||
op_type: "Constant"
|
||||
attribute {
|
||||
name: "value"
|
||||
t {
|
||||
dims: 1
|
||||
data_type: 7
|
||||
int64_data: 10
|
||||
name: "frame_length_tensor"
|
||||
}
|
||||
type: TENSOR
|
||||
}
|
||||
}
|
||||
node {
|
||||
input: "signal"
|
||||
input: "frame_step"
|
||||
input: "window"
|
||||
input: "frame_length"
|
||||
output: "Y"
|
||||
op_type: "STFT"
|
||||
attribute {
|
||||
name: "onesided"
|
||||
i: 0
|
||||
type: INT
|
||||
}
|
||||
}
|
||||
name: "g"
|
||||
input {
|
||||
name: "signal"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 2
|
||||
}
|
||||
dim {
|
||||
dim_value: 48
|
||||
}
|
||||
dim {
|
||||
dim_value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
input {
|
||||
name: "window"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
output {
|
||||
name: "Y"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
opset_import {
|
||||
domain: ""
|
||||
version: 17
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
ir_version: 8
|
||||
graph {
|
||||
node {
|
||||
output: "frame_step"
|
||||
name: "frame_step_const"
|
||||
op_type: "Constant"
|
||||
attribute {
|
||||
name: "value"
|
||||
t {
|
||||
dims: 1
|
||||
data_type: 7
|
||||
int64_data: 8
|
||||
name: "frame_step_tensor"
|
||||
}
|
||||
type: TENSOR
|
||||
}
|
||||
}
|
||||
node {
|
||||
input: "signal"
|
||||
input: "frame_step"
|
||||
input: ""
|
||||
output: "Y"
|
||||
op_type: "STFT"
|
||||
attribute {
|
||||
name: "onesided"
|
||||
i: 0
|
||||
type: INT
|
||||
}
|
||||
}
|
||||
name: "g"
|
||||
input {
|
||||
name: "signal"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 1
|
||||
}
|
||||
dim {
|
||||
dim_value: 128
|
||||
}
|
||||
dim {
|
||||
dim_value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
output {
|
||||
name: "Y"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
opset_import {
|
||||
domain: ""
|
||||
version: 17
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
ir_version: 8
|
||||
graph {
|
||||
node {
|
||||
output: "frame_step"
|
||||
name: "frame_step_const"
|
||||
op_type: "Constant"
|
||||
attribute {
|
||||
name: "value"
|
||||
t {
|
||||
dims: 1
|
||||
data_type: 7
|
||||
int64_data: 8
|
||||
name: "frame_step_tensor"
|
||||
}
|
||||
type: TENSOR
|
||||
}
|
||||
}
|
||||
node {
|
||||
input: "signal"
|
||||
input: "frame_step"
|
||||
input: ""
|
||||
output: "Y"
|
||||
op_type: "STFT"
|
||||
attribute {
|
||||
name: "onesided"
|
||||
i: 0
|
||||
type: INT
|
||||
}
|
||||
}
|
||||
name: "g"
|
||||
input {
|
||||
name: "signal"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 2
|
||||
}
|
||||
dim {
|
||||
dim_value: 64
|
||||
}
|
||||
dim {
|
||||
dim_value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
output {
|
||||
name: "Y"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
opset_import {
|
||||
domain: ""
|
||||
version: 17
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
ir_version: 8
|
||||
graph {
|
||||
node {
|
||||
output: "frame_step"
|
||||
name: "frame_step_const"
|
||||
op_type: "Constant"
|
||||
attribute {
|
||||
name: "value"
|
||||
t {
|
||||
dims: 1
|
||||
data_type: 7
|
||||
int64_data: 8
|
||||
name: "frame_step_tensor"
|
||||
}
|
||||
type: TENSOR
|
||||
}
|
||||
}
|
||||
node {
|
||||
output: "frame_length"
|
||||
name: "frame_length_const"
|
||||
op_type: "Constant"
|
||||
attribute {
|
||||
name: "value"
|
||||
t {
|
||||
dims: 1
|
||||
data_type: 7
|
||||
int64_data: 24
|
||||
name: "frame_length_tensor"
|
||||
}
|
||||
type: TENSOR
|
||||
}
|
||||
}
|
||||
node {
|
||||
input: "signal"
|
||||
input: "frame_step"
|
||||
input: ""
|
||||
input: "frame_length"
|
||||
output: "Y"
|
||||
op_type: "STFT"
|
||||
attribute {
|
||||
name: "onesided"
|
||||
i: 0
|
||||
type: INT
|
||||
}
|
||||
}
|
||||
input {
|
||||
name: "signal"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 4
|
||||
}
|
||||
dim {
|
||||
dim_value: 32
|
||||
}
|
||||
dim {
|
||||
dim_value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
output {
|
||||
name: "Y"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
opset_import {
|
||||
domain: ""
|
||||
version: 17
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
ir_version: 8
|
||||
graph {
|
||||
node {
|
||||
output: "frame_step"
|
||||
name: "frame_step_const"
|
||||
op_type: "Constant"
|
||||
attribute {
|
||||
name: "value"
|
||||
t {
|
||||
dims: 1
|
||||
data_type: 7
|
||||
int64_data: 8
|
||||
name: "frame_step_tensor"
|
||||
}
|
||||
type: TENSOR
|
||||
}
|
||||
}
|
||||
node {
|
||||
input: "signal"
|
||||
input: "frame_step"
|
||||
input: ""
|
||||
output: "Y"
|
||||
op_type: "STFT"
|
||||
attribute {
|
||||
name: "onesided"
|
||||
i: 0
|
||||
type: INT
|
||||
}
|
||||
}
|
||||
name: "g"
|
||||
input {
|
||||
name: "signal"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 1
|
||||
}
|
||||
dim {
|
||||
dim_value: 128
|
||||
}
|
||||
dim {
|
||||
dim_value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
output {
|
||||
name: "Y"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
opset_import {
|
||||
domain: ""
|
||||
version: 17
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
ir_version: 8
|
||||
graph {
|
||||
node {
|
||||
output: "frame_step"
|
||||
name: "frame_step_const"
|
||||
op_type: "Constant"
|
||||
attribute {
|
||||
name: "value"
|
||||
t {
|
||||
dims: 1
|
||||
data_type: 7
|
||||
int64_data: 8
|
||||
name: "frame_step_tensor"
|
||||
}
|
||||
type: TENSOR
|
||||
}
|
||||
}
|
||||
node {
|
||||
input: "signal"
|
||||
input: "frame_step"
|
||||
input: "window"
|
||||
input: "frame_length"
|
||||
output: "Y"
|
||||
op_type: "STFT"
|
||||
attribute {
|
||||
name: "onesided"
|
||||
i: 1
|
||||
type: INT
|
||||
}
|
||||
}
|
||||
input {
|
||||
name: "signal"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 2
|
||||
}
|
||||
dim {
|
||||
dim_value: 32
|
||||
}
|
||||
dim {
|
||||
dim_value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
input {
|
||||
name: "window"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 16
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
input {
|
||||
name: "frame_length"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 16
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
output {
|
||||
name: "Y"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
opset_import {
|
||||
domain: ""
|
||||
version: 17
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
ir_version: 8
|
||||
graph {
|
||||
node {
|
||||
output: "frame_length"
|
||||
name: "frame_length_const"
|
||||
op_type: "Constant"
|
||||
attribute {
|
||||
name: "value"
|
||||
t {
|
||||
dims: 1
|
||||
data_type: 7
|
||||
int64_data: 16
|
||||
name: "frame_length_tensor"
|
||||
}
|
||||
type: TENSOR
|
||||
}
|
||||
}
|
||||
node {
|
||||
input: "signal"
|
||||
input: "frame_step"
|
||||
input: "window"
|
||||
input: "frame_length"
|
||||
output: "Y"
|
||||
op_type: "STFT"
|
||||
attribute {
|
||||
name: "onesided"
|
||||
i: 1
|
||||
type: INT
|
||||
}
|
||||
}
|
||||
name: "g"
|
||||
input {
|
||||
name: "signal"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 2
|
||||
}
|
||||
dim {
|
||||
dim_value: 32
|
||||
}
|
||||
dim {
|
||||
dim_value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
input {
|
||||
name: "frame_step"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
input {
|
||||
name: "window"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 16
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
output {
|
||||
name: "Y"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
opset_import {
|
||||
domain: ""
|
||||
version: 17
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
ir_version: 8
|
||||
graph {
|
||||
node {
|
||||
output: "frame_step"
|
||||
name: "frame_step_const"
|
||||
op_type: "Constant"
|
||||
attribute {
|
||||
name: "value"
|
||||
t {
|
||||
dims: 1
|
||||
data_type: 7
|
||||
int64_data: 8
|
||||
name: "frame_step_tensor"
|
||||
}
|
||||
type: TENSOR
|
||||
}
|
||||
}
|
||||
node {
|
||||
output: "frame_length"
|
||||
name: "frame_length_const"
|
||||
op_type: "Constant"
|
||||
attribute {
|
||||
name: "value"
|
||||
t {
|
||||
dims: 1
|
||||
data_type: 7
|
||||
int64_data: 16
|
||||
name: "frame_length_tensor"
|
||||
}
|
||||
type: TENSOR
|
||||
}
|
||||
}
|
||||
node {
|
||||
input: "signal"
|
||||
input: "frame_step"
|
||||
input: "window"
|
||||
input: "frame_length"
|
||||
output: "Y"
|
||||
op_type: "STFT"
|
||||
attribute {
|
||||
name: "onesided"
|
||||
i: 1
|
||||
type: INT
|
||||
}
|
||||
}
|
||||
input {
|
||||
name: "signal"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 2
|
||||
}
|
||||
dim {
|
||||
dim_value: 32
|
||||
}
|
||||
dim {
|
||||
dim_value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
input {
|
||||
name: "window"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 16
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
output {
|
||||
name: "Y"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
opset_import {
|
||||
domain: ""
|
||||
version: 17
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
ir_version: 8
|
||||
graph {
|
||||
node {
|
||||
output: "frame_step"
|
||||
name: "frame_step_const"
|
||||
op_type: "Constant"
|
||||
attribute {
|
||||
name: "value"
|
||||
t {
|
||||
dims: 1
|
||||
data_type: 7
|
||||
int64_data: 8
|
||||
name: "frame_step_tensor"
|
||||
}
|
||||
type: TENSOR
|
||||
}
|
||||
}
|
||||
node {
|
||||
output: "frame_length"
|
||||
name: "frame_length_const"
|
||||
op_type: "Constant"
|
||||
attribute {
|
||||
name: "value"
|
||||
t {
|
||||
dims: 1
|
||||
data_type: 7
|
||||
int64_data: 16
|
||||
name: "frame_length_tensor"
|
||||
}
|
||||
type: TENSOR
|
||||
}
|
||||
}
|
||||
node {
|
||||
input: "signal"
|
||||
input: "frame_step"
|
||||
input: "window"
|
||||
input: "frame_length"
|
||||
output: "Y"
|
||||
op_type: "STFT"
|
||||
attribute {
|
||||
name: "onesided"
|
||||
i: 1
|
||||
type: INT
|
||||
}
|
||||
}
|
||||
input {
|
||||
name: "signal"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 2
|
||||
}
|
||||
dim {
|
||||
dim_value: 32
|
||||
}
|
||||
dim {
|
||||
dim_value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
input {
|
||||
name: "window"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 16
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
output {
|
||||
name: "Y"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
opset_import {
|
||||
domain: ""
|
||||
version: 17
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
ir_version: 8
|
||||
graph {
|
||||
node {
|
||||
output: "frame_step"
|
||||
name: "frame_step_const"
|
||||
op_type: "Constant"
|
||||
attribute {
|
||||
name: "value"
|
||||
t {
|
||||
dims: 1
|
||||
data_type: 7
|
||||
int64_data: 8
|
||||
name: "frame_step_tensor"
|
||||
}
|
||||
type: TENSOR
|
||||
}
|
||||
}
|
||||
node {
|
||||
input: "signal"
|
||||
input: "frame_step"
|
||||
input: ""
|
||||
output: "Y"
|
||||
op_type: "STFT"
|
||||
}
|
||||
name: "g"
|
||||
input {
|
||||
name: "signal"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 1
|
||||
}
|
||||
dim {
|
||||
dim_value: 128
|
||||
}
|
||||
dim {
|
||||
dim_value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
output {
|
||||
name: "Y"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: 1
|
||||
shape {
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
dim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
opset_import {
|
||||
domain: ""
|
||||
version: 17
|
||||
}
|
@ -6452,249 +6452,3 @@ NGRAPH_TEST(${BACKEND_NAME}, onnx_model_unique_3d_with_duplicates_and_axis_2) {
|
||||
|
||||
test_case.run();
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft) {
|
||||
auto function = onnx_import::import_onnx_model(
|
||||
file_util::path_join(CommonTestUtils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/dft.onnx"));
|
||||
auto test_case = test::TestCase(function, s_device);
|
||||
test_case.add_input<float>(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f,
|
||||
3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f,
|
||||
6.000000f, 0.000000f, 7.000000f, 0.000000f, 8.000000f, 0.000000f,
|
||||
9.000000f, 0.000000f, 10.000000f, 0.000000f, 11.000000f, 0.000000f,
|
||||
12.000000f, 0.000000f, 13.000000f, 0.000000f, 14.000000f, 0.000000f});
|
||||
test_case.add_expected_output<float>(
|
||||
Shape{3, 5, 2},
|
||||
{10.000000f, 0.000000f, -2.500000f, 3.440955f, -2.500000f, 0.812299f, -2.500000f, -0.812299f,
|
||||
-2.500000f, -3.440955f, 35.000000f, 0.000000f, -2.500000f, 3.440955f, -2.500000f, 0.812299f,
|
||||
-2.500000f, -0.812299f, -2.500000f, -3.440955f, 60.000000f, 0.000000f, -2.500000f, 3.440955f,
|
||||
-2.500000f, 0.812299f, -2.500000f, -0.812299f, -2.500000f, -3.440955f});
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_only_real) {
|
||||
auto function = onnx_import::import_onnx_model(
|
||||
file_util::path_join(CommonTestUtils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/dft_only_real.onnx"));
|
||||
auto test_case = test::TestCase(function, s_device);
|
||||
test_case.add_input<float>(Shape{3, 5, 1},
|
||||
{
|
||||
0.000000f,
|
||||
1.000000f,
|
||||
2.000000f,
|
||||
3.000000f,
|
||||
4.000000f,
|
||||
5.000000f,
|
||||
6.000000f,
|
||||
7.000000f,
|
||||
8.000000f,
|
||||
9.000000f,
|
||||
10.000000f,
|
||||
11.000000f,
|
||||
12.000000f,
|
||||
13.000000f,
|
||||
14.000000f,
|
||||
});
|
||||
test_case.add_expected_output<float>(
|
||||
Shape{3, 5, 2},
|
||||
{10.000000f, 0.000000f, -2.500000f, 3.440955f, -2.500000f, 0.812299f, -2.500000f, -0.812299f,
|
||||
-2.500000f, -3.440955f, 35.000000f, 0.000000f, -2.500000f, 3.440955f, -2.500000f, 0.812299f,
|
||||
-2.500000f, -0.812299f, -2.500000f, -3.440955f, 60.000000f, 0.000000f, -2.500000f, 3.440955f,
|
||||
-2.500000f, 0.812299f, -2.500000f, -0.812299f, -2.500000f, -3.440955f});
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_onesided) {
|
||||
auto function = onnx_import::import_onnx_model(
|
||||
file_util::path_join(CommonTestUtils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/dft_onesided.onnx"));
|
||||
auto test_case = test::TestCase(function, s_device);
|
||||
test_case.add_input<float>(
|
||||
Shape{2, 4},
|
||||
{0.000000f, 1.000000f, 2.000000f, 3.000000f, 4.000000f, 5.000000f, 6.000000f, 7.000000f});
|
||||
test_case.add_expected_output<float>(Shape{2, 3, 2},
|
||||
{6.000000f,
|
||||
0.000000f,
|
||||
-2.000000f,
|
||||
2.000000f,
|
||||
-2.000000f,
|
||||
0.000000f,
|
||||
22.000000f,
|
||||
0.000000f,
|
||||
-2.000000f,
|
||||
2.000000f,
|
||||
-2.000000f,
|
||||
0.000000f});
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_onesided_skip_convert_to_complex) {
|
||||
auto function =
|
||||
onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/dft_onesided_skip_convert_to_complex.onnx"));
|
||||
auto test_case = test::TestCase(function, s_device);
|
||||
test_case.add_input<float>(
|
||||
Shape{2, 4, 1},
|
||||
{0.000000f, 1.000000f, 2.000000f, 3.000000f, 4.000000f, 5.000000f, 6.000000f, 7.000000f});
|
||||
test_case.add_expected_output<float>(Shape{2, 3, 1, 2},
|
||||
{6.000000f,
|
||||
0.000000f,
|
||||
-2.000000f,
|
||||
2.000000f,
|
||||
-2.000000f,
|
||||
0.000000f,
|
||||
22.000000f,
|
||||
0.000000f,
|
||||
-2.000000f,
|
||||
2.000000f,
|
||||
-2.000000f,
|
||||
0.000000f});
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_length_provided) {
|
||||
auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/dft_lenght_provided.onnx"));
|
||||
auto test_case = test::TestCase(function, s_device);
|
||||
test_case.add_input<float>(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f,
|
||||
3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f,
|
||||
6.000000f, 0.000000f, 7.000000f, 0.000000f, 8.000000f, 0.000000f,
|
||||
9.000000f, 0.000000f, 10.000000f, 0.000000f, 11.000000f, 0.000000f,
|
||||
12.000000f, 0.000000f, 13.000000f, 0.000000f, 14.000000f, 0.000000f});
|
||||
test_case.add_expected_output<float>(
|
||||
Shape{1, 5, 2},
|
||||
{0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f, 3.000000f, 0.000000f, 4.000000f, 0.000000f});
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_length_provided_onesided) {
|
||||
auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/dft_lenght_provided_onesided.onnx"));
|
||||
auto test_case = test::TestCase(function, s_device);
|
||||
test_case.add_input<float>(Shape{4, 3},
|
||||
{0.000000f,
|
||||
1.000000f,
|
||||
2.000000f,
|
||||
3.000000f,
|
||||
4.000000f,
|
||||
5.000000f,
|
||||
6.000000f,
|
||||
7.000000f,
|
||||
8.000000f,
|
||||
9.000000f,
|
||||
10.000000f,
|
||||
11.000000f});
|
||||
test_case.add_expected_output<float>(Shape{1, 3, 2},
|
||||
{0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f});
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inverse) {
|
||||
auto function = onnx_import::import_onnx_model(
|
||||
file_util::path_join(CommonTestUtils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/dft_inverse.onnx"));
|
||||
auto test_case = test::TestCase(function, s_device);
|
||||
test_case.add_input<float>(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f,
|
||||
3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f,
|
||||
6.000000f, 0.000000f, 7.000000f, 0.000000f, 8.000000f, 0.000000f,
|
||||
9.000000f, 0.000000f, 10.000000f, 0.000000f, 11.000000f, 0.000000f,
|
||||
12.000000f, 0.000000f, 13.000000f, 0.000000f, 14.000000f, 0.000000f});
|
||||
test_case.add_expected_output<float>(
|
||||
Shape{3, 5, 2},
|
||||
{2.000000f, 0.000000f, -0.500000f, -0.688191f, -0.500000f, -0.162460f, -0.500000f, 0.162460f,
|
||||
-0.500000f, 0.688191f, 7.000000f, 0.000000f, -0.500000f, -0.688191f, -0.500000f, -0.162460f,
|
||||
-0.500000f, 0.162460f, -0.500000f, 0.688191f, 12.000000f, 0.000000f, -0.500000f, -0.688191f,
|
||||
-0.500000f, -0.162460f, -0.500000f, 0.162460f, -0.500000f, 0.688191f});
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_only_real) {
|
||||
auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/dft_inverse_only_real.onnx"));
|
||||
auto test_case = test::TestCase(function, s_device);
|
||||
test_case.add_input<float>(Shape{3, 5, 1},
|
||||
{0.000000f,
|
||||
1.000000f,
|
||||
2.000000f,
|
||||
3.000000f,
|
||||
4.000000f,
|
||||
5.000000f,
|
||||
6.000000f,
|
||||
7.000000f,
|
||||
8.000000f,
|
||||
9.000000f,
|
||||
10.000000f,
|
||||
11.000000f,
|
||||
12.000000f,
|
||||
13.000000f,
|
||||
14.000000f});
|
||||
test_case.add_expected_output<float>(
|
||||
Shape{3, 5, 2},
|
||||
{2.000000f, 0.000000f, -0.500000f, -0.688191f, -0.500000f, -0.162460f, -0.500000f, 0.162460f,
|
||||
-0.500000f, 0.688191f, 7.000000f, 0.000000f, -0.500000f, -0.688191f, -0.500000f, -0.162460f,
|
||||
-0.500000f, 0.162460f, -0.500000f, 0.688191f, 12.000000f, 0.000000f, -0.500000f, -0.688191f,
|
||||
-0.500000f, -0.162460f, -0.500000f, 0.162460f, -0.500000f, 0.688191f});
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_onesided) {
|
||||
auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/dft_inverse_onesided.onnx"));
|
||||
auto test_case = test::TestCase(function, s_device);
|
||||
test_case.add_input<float>(Shape{2, 3, 2},
|
||||
{6.000000f,
|
||||
0.000000f,
|
||||
-2.000000f,
|
||||
2.000000f,
|
||||
-2.000000f,
|
||||
0.000000f,
|
||||
22.000000f,
|
||||
0.000000f,
|
||||
-2.000000f,
|
||||
2.000000f,
|
||||
-2.000000f,
|
||||
0.000000f});
|
||||
test_case.add_expected_output<float>(
|
||||
Shape{2, 4},
|
||||
{0.000000f, 1.000000f, 2.000000f, 3.000000f, 4.000000f, 5.000000f, 6.000000f, 7.000000f});
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_onesided_real_input) {
|
||||
auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/dft_inverse_onesided_real_input.onnx"));
|
||||
auto test_case = test::TestCase(function, s_device);
|
||||
test_case.add_input<float>(Shape{2, 3, 1}, {1.000000f, 0.000000f, -1.000000f, 0.5000000f, -0.5000000f, 0.000000f});
|
||||
test_case.add_expected_output<float>(Shape{2, 3, 1},
|
||||
{0.750000f, -0.250000f, -0.500000f, 0.250000f, 0.250000f, -0.500000f});
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inversed_length_provided) {
|
||||
auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/dft_inversed_lenght_provided.onnx"));
|
||||
auto test_case = test::TestCase(function, s_device);
|
||||
test_case.add_input<float>(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f,
|
||||
3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f,
|
||||
6.000000f, 0.000000f, 7.000000f, 0.000000f, 8.000000f, 0.000000f,
|
||||
9.000000f, 0.000000f, 10.000000f, 0.000000f, 11.000000f, 0.000000f,
|
||||
12.000000f, 0.000000f, 13.000000f, 0.000000f, 14.000000f, 0.000000f});
|
||||
test_case.add_expected_output<float>(
|
||||
Shape{1, 5, 2},
|
||||
{0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f, 3.000000f, 0.000000f, 4.000000f, 0.000000f});
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_length_provided_onesided) {
|
||||
auto function =
|
||||
onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/dft_inverse_lenght_provided_onesided.onnx"));
|
||||
auto test_case = test::TestCase(function, s_device);
|
||||
test_case.add_input<float>(Shape{1, 3, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f});
|
||||
test_case.add_expected_output<float>(Shape{4, 3},
|
||||
{0.000000f,
|
||||
1.000000f,
|
||||
2.000000f,
|
||||
3.000000f,
|
||||
4.000000f,
|
||||
5.000000f,
|
||||
6.000000f,
|
||||
7.000000f,
|
||||
8.000000f,
|
||||
9.000000f,
|
||||
10.000000f,
|
||||
11.000000f});
|
||||
}
|
||||
|
1578
src/frontends/onnx/tests/onnx_import_signal.in.cpp
Normal file
1578
src/frontends/onnx/tests/onnx_import_signal.in.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user