Update ONNX importer LSTM to use v5 LSTMSequence (#2511)

This commit is contained in:
Katarzyna Mitrus
2020-10-09 15:24:10 +02:00
committed by GitHub
parent 2e49b4e4d8
commit 00faee86e0
13 changed files with 1364 additions and 47 deletions

View File

@@ -0,0 +1,211 @@
ir_version: 7
producer_name: "onnx-importer-test"
graph {
node {
output: "W"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 2
dims: 8
dims: 2
data_type: 1
float_data: 0.31403765082359314
float_data: -0.16793324053287506
float_data: 1.3882579803466797
float_data: -0.690295398235321
float_data: -0.39940449595451355
float_data: -0.7833511233329773
float_data: -0.30992957949638367
float_data: 0.35575729608535767
float_data: -0.46826308965682983
float_data: 1.1741459369659424
float_data: -2.4147889614105225
float_data: -0.42783254384994507
float_data: -0.821994960308075
float_data: -0.03900860995054245
float_data: -0.43670088052749634
float_data: -0.5381056666374207
float_data: 0.31403765082359314
float_data: -0.16793324053287506
float_data: 1.3882579803466797
float_data: -0.690295398235321
float_data: -0.39940449595451355
float_data: -0.7833511233329773
float_data: -0.30992957949638367
float_data: 0.35575729608535767
float_data: -0.46826308965682983
float_data: 1.1741459369659424
float_data: -2.4147889614105225
float_data: -0.42783254384994507
float_data: -0.821994960308075
float_data: -0.03900860995054245
float_data: -0.43670088052749634
float_data: -0.5381056666374207
name: "const_tensor_W"
}
type: TENSOR
}
}
node {
output: "R"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 2
dims: 8
dims: 2
data_type: 1
float_data: 0.8490582704544067
float_data: 0.45121243596076965
float_data: -1.179901361465454
float_data: 0.13536448776721954
float_data: 0.813286542892456
float_data: 0.6017516255378723
float_data: 0.4847572445869446
float_data: -1.2136037349700928
float_data: 0.16383321583271027
float_data: 1.5106260776519775
float_data: 1.1177502870559692
float_data: 0.2358246147632599
float_data: 0.575465202331543
float_data: 0.4387988746166229
float_data: 0.7399293780326843
float_data: 0.4517557919025421
float_data: 0.8490582704544067
float_data: 0.45121243596076965
float_data: -1.179901361465454
float_data: 0.13536448776721954
float_data: 0.813286542892456
float_data: 0.6017516255378723
float_data: 0.4847572445869446
float_data: -1.2136037349700928
float_data: 0.16383321583271027
float_data: 1.5106260776519775
float_data: 1.1177502870559692
float_data: 0.2358246147632599
float_data: 0.575465202331543
float_data: 0.4387988746166229
float_data: 0.7399293780326843
float_data: 0.4517557919025421
name: "const_tensor"
}
type: TENSOR
}
}
node {
input: "X"
input: "W"
input: "R"
output: "Y"
output: "Y_h"
output: "Y_c"
op_type: "LSTM"
attribute {
name: "activations"
strings: "sigmoid"
strings: "tanh"
strings: "tanh"
strings: "sigmoid"
strings: "tanh"
strings: "tanh"
type: STRINGS
}
attribute {
name: "direction"
s: "bidirectional"
type: STRING
}
attribute {
name: "hidden_size"
i: 2
type: INT
}
}
name: "test-model-lstm"
input {
name: "X"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y_h"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y_c"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
domain: ""
version: 12
}

View File

@@ -0,0 +1,186 @@
ir_version: 7
producer_name: "onnx-importer-test"
graph {
node {
output: "W"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 1
dims: 8
dims: 2
data_type: 1
float_data: 0.31403765082359314
float_data: -0.16793324053287506
float_data: 1.3882579803466797
float_data: -0.690295398235321
float_data: -0.39940449595451355
float_data: -0.7833511233329773
float_data: -0.30992957949638367
float_data: 0.35575729608535767
float_data: -0.46826308965682983
float_data: 1.1741459369659424
float_data: -2.4147889614105225
float_data: -0.42783254384994507
float_data: -0.821994960308075
float_data: -0.03900860995054245
float_data: -0.43670088052749634
float_data: -0.5381056666374207
name: "const_tensor_W"
}
type: TENSOR
}
}
node {
output: "R"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 1
dims: 8
dims: 2
data_type: 1
float_data: 0.8490582704544067
float_data: 0.45121243596076965
float_data: -1.179901361465454
float_data: 0.13536448776721954
float_data: 0.813286542892456
float_data: 0.6017516255378723
float_data: 0.4847572445869446
float_data: -1.2136037349700928
float_data: 0.16383321583271027
float_data: 1.5106260776519775
float_data: 1.1177502870559692
float_data: 0.2358246147632599
float_data: 0.575465202331543
float_data: 0.4387988746166229
float_data: 0.7399293780326843
float_data: 0.4517557919025421
name: "const_tensor"
}
type: TENSOR
}
}
node {
input: "X"
input: "W"
input: "R"
output: "Y"
output: "Y_h"
output: "Y_c"
op_type: "LSTM"
attribute {
name: "activations"
strings: "sigmoid"
strings: "tanh"
strings: "tanh"
type: STRINGS
}
attribute {
name: "clip"
f: 0.10000000149011612
type: FLOAT
}
attribute {
name: "direction"
s: "forward"
type: STRING
}
attribute {
name: "hidden_size"
i: 2
type: INT
}
attribute {
name: "input_forget"
i: 0
type: INT
}
}
name: "test-model-lstm"
input {
name: "X"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y_h"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y_c"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
domain: ""
version: 12
}

View File

@@ -0,0 +1,176 @@
ir_version: 7
producer_name: "onnx-importer-test"
graph {
node {
output: "W"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 1
dims: 8
dims: 2
data_type: 1
float_data: 0.31403765082359314
float_data: -0.16793324053287506
float_data: 1.3882579803466797
float_data: -0.690295398235321
float_data: -0.39940449595451355
float_data: -0.7833511233329773
float_data: -0.30992957949638367
float_data: 0.35575729608535767
float_data: -0.46826308965682983
float_data: 1.1741459369659424
float_data: -2.4147889614105225
float_data: -0.42783254384994507
float_data: -0.821994960308075
float_data: -0.03900860995054245
float_data: -0.43670088052749634
float_data: -0.5381056666374207
name: "const_tensor_W"
}
type: TENSOR
}
}
node {
output: "R"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 1
dims: 8
dims: 2
data_type: 1
float_data: 0.8490582704544067
float_data: 0.45121243596076965
float_data: -1.179901361465454
float_data: 0.13536448776721954
float_data: 0.813286542892456
float_data: 0.6017516255378723
float_data: 0.4847572445869446
float_data: -1.2136037349700928
float_data: 0.16383321583271027
float_data: 1.5106260776519775
float_data: 1.1177502870559692
float_data: 0.2358246147632599
float_data: 0.575465202331543
float_data: 0.4387988746166229
float_data: 0.7399293780326843
float_data: 0.4517557919025421
name: "const_tensor"
}
type: TENSOR
}
}
node {
input: "X"
input: "W"
input: "R"
output: "Y"
output: "Y_h"
output: "Y_c"
op_type: "LSTM"
attribute {
name: "activations"
strings: "sigmoid"
strings: "tanh"
strings: "tanh"
type: STRINGS
}
attribute {
name: "direction"
s: "forward"
type: STRING
}
attribute {
name: "hidden_size"
i: 2
type: INT
}
}
name: "test-model-lstm"
input {
name: "X"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y_h"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y_c"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
domain: ""
version: 12
}

View File

@@ -0,0 +1,209 @@
ir_version: 7
producer_name: "onnx-importer-test"
graph {
node {
output: "W"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 1
dims: 12
dims: 1
data_type: 1
float_data: 0.31403765082359314
float_data: -0.16793324053287506
float_data: 1.3882579803466797
float_data: -0.690295398235321
float_data: -0.39940449595451355
float_data: -0.7833511233329773
float_data: -0.30992957949638367
float_data: 0.35575729608535767
float_data: -0.46826308965682983
float_data: 1.1741459369659424
float_data: -2.4147889614105225
float_data: -0.42783254384994507
name: "const_tensor_W"
}
type: TENSOR
}
}
node {
output: "R"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 1
dims: 12
dims: 3
data_type: 1
float_data: 0.8490582704544067
float_data: 0.45121243596076965
float_data: -1.179901361465454
float_data: 0.13536448776721954
float_data: 0.813286542892456
float_data: 0.6017516255378723
float_data: 0.4847572445869446
float_data: -1.2136037349700928
float_data: 0.16383321583271027
float_data: 1.5106260776519775
float_data: 1.1177502870559692
float_data: 0.2358246147632599
float_data: 0.8490582704544067
float_data: 0.45121243596076965
float_data: -1.179901361465454
float_data: 0.13536448776721954
float_data: 0.813286542892456
float_data: 0.6017516255378723
float_data: 0.4847572445869446
float_data: -1.2136037349700928
float_data: 0.16383321583271027
float_data: 1.5106260776519775
float_data: 1.1177502870559692
float_data: 0.2358246147632599
float_data: 0.8490582704544067
float_data: 0.45121243596076965
float_data: -1.179901361465454
float_data: 0.13536448776721954
float_data: 0.813286542892456
float_data: 0.6017516255378723
float_data: 0.4847572445869446
float_data: -1.2136037349700928
float_data: 0.16383321583271027
float_data: 1.5106260776519775
float_data: 1.1177502870559692
float_data: 0.2358246147632599
name: "const_tensor"
}
type: TENSOR
}
}
node {
output: "sequence_lens"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 2
data_type: 6
int32_data: 1
int32_data: 2
name: "const_tensor"
}
type: TENSOR
}
}
node {
input: "X"
input: "W"
input: "R"
input: ""
input: "sequence_lens"
output: "Y"
output: "Y_h"
output: "Y_c"
op_type: "LSTM"
attribute {
name: "activations"
strings: "sigmoid"
strings: "tanh"
strings: "tanh"
type: STRINGS
}
attribute {
name: "direction"
s: "forward"
type: STRING
}
attribute {
name: "hidden_size"
i: 3
type: INT
}
}
name: "test-model-lstm"
input {
name: "X"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
dim {
dim_value: 1
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 3
}
}
}
}
}
output {
name: "Y_h"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 3
}
}
}
}
}
output {
name: "Y_c"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 3
}
}
}
}
}
}
opset_import {
domain: ""
version: 12
}

View File

@@ -0,0 +1,176 @@
ir_version: 7
producer_name: "onnx-importer-test"
graph {
node {
output: "W"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 1
dims: 8
dims: 2
data_type: 1
float_data: 0.31403765082359314
float_data: -0.16793324053287506
float_data: 1.3882579803466797
float_data: -0.690295398235321
float_data: -0.39940449595451355
float_data: -0.7833511233329773
float_data: -0.30992957949638367
float_data: 0.35575729608535767
float_data: -0.46826308965682983
float_data: 1.1741459369659424
float_data: -2.4147889614105225
float_data: -0.42783254384994507
float_data: -0.821994960308075
float_data: -0.03900860995054245
float_data: -0.43670088052749634
float_data: -0.5381056666374207
name: "const_tensor_W"
}
type: TENSOR
}
}
node {
output: "R"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 1
dims: 8
dims: 2
data_type: 1
float_data: 0.8490582704544067
float_data: 0.45121243596076965
float_data: -1.179901361465454
float_data: 0.13536448776721954
float_data: 0.813286542892456
float_data: 0.6017516255378723
float_data: 0.4847572445869446
float_data: -1.2136037349700928
float_data: 0.16383321583271027
float_data: 1.5106260776519775
float_data: 1.1177502870559692
float_data: 0.2358246147632599
float_data: 0.575465202331543
float_data: 0.4387988746166229
float_data: 0.7399293780326843
float_data: 0.4517557919025421
name: "const_tensor"
}
type: TENSOR
}
}
node {
input: "X"
input: "W"
input: "R"
output: "Y"
output: "Y_h"
output: "Y_c"
op_type: "LSTM"
attribute {
name: "activations"
strings: "sigmoid"
strings: "tanh"
strings: "tanh"
type: STRINGS
}
attribute {
name: "direction"
s: "reverse"
type: STRING
}
attribute {
name: "hidden_size"
i: 2
type: INT
}
}
name: "test-model-lstm"
input {
name: "X"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y_h"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y_c"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
domain: ""
version: 12
}

View File

@@ -0,0 +1,209 @@
ir_version: 7
producer_name: "onnx-importer-test"
graph {
node {
output: "W"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 1
dims: 12
dims: 1
data_type: 1
float_data: 0.31403765082359314
float_data: -0.16793324053287506
float_data: 1.3882579803466797
float_data: -0.690295398235321
float_data: -0.39940449595451355
float_data: -0.7833511233329773
float_data: -0.30992957949638367
float_data: 0.35575729608535767
float_data: -0.46826308965682983
float_data: 1.1741459369659424
float_data: -2.4147889614105225
float_data: -0.42783254384994507
name: "const_tensor_W"
}
type: TENSOR
}
}
node {
output: "R"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 1
dims: 12
dims: 3
data_type: 1
float_data: 0.8490582704544067
float_data: 0.45121243596076965
float_data: -1.179901361465454
float_data: 0.13536448776721954
float_data: 0.813286542892456
float_data: 0.6017516255378723
float_data: 0.4847572445869446
float_data: -1.2136037349700928
float_data: 0.16383321583271027
float_data: 1.5106260776519775
float_data: 1.1177502870559692
float_data: 0.2358246147632599
float_data: 0.8490582704544067
float_data: 0.45121243596076965
float_data: -1.179901361465454
float_data: 0.13536448776721954
float_data: 0.813286542892456
float_data: 0.6017516255378723
float_data: 0.4847572445869446
float_data: -1.2136037349700928
float_data: 0.16383321583271027
float_data: 1.5106260776519775
float_data: 1.1177502870559692
float_data: 0.2358246147632599
float_data: 0.8490582704544067
float_data: 0.45121243596076965
float_data: -1.179901361465454
float_data: 0.13536448776721954
float_data: 0.813286542892456
float_data: 0.6017516255378723
float_data: 0.4847572445869446
float_data: -1.2136037349700928
float_data: 0.16383321583271027
float_data: 1.5106260776519775
float_data: 1.1177502870559692
float_data: 0.2358246147632599
name: "const_tensor"
}
type: TENSOR
}
}
node {
output: "sequence_lens"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 2
data_type: 6
int32_data: 1
int32_data: 2
name: "const_tensor"
}
type: TENSOR
}
}
node {
input: "X"
input: "W"
input: "R"
input: ""
input: "sequence_lens"
output: "Y"
output: "Y_h"
output: "Y_c"
op_type: "LSTM"
attribute {
name: "activations"
strings: "sigmoid"
strings: "tanh"
strings: "tanh"
type: STRINGS
}
attribute {
name: "direction"
s: "reverse"
type: STRING
}
attribute {
name: "hidden_size"
i: 3
type: INT
}
}
name: "test-model-lstm"
input {
name: "X"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
dim {
dim_value: 1
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 3
}
}
}
}
}
output {
name: "Y_h"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 3
}
}
}
}
}
output {
name: "Y_c"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 3
}
}
}
}
}
}
opset_import {
domain: ""
version: 12
}

View File

@@ -43,10 +43,145 @@ static std::string s_manifest = "${MANIFEST}";
using TestEngine = test::ENGINE_CLASS_NAME(${BACKEND_NAME});
// ONNX LSTM tests (implemented by nGraph LSTMCell and LSTMSequence)
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_with_clip)
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_default_const)
{
auto function = onnx_import::import_onnx_model(
file_util::path_join(SERIALIZED_ZOO, "onnx/lstm_fwd_with_clip.prototxt"));
file_util::path_join(SERIALIZED_ZOO, "onnx/lstm_fwd_default_const.prototxt"));
auto test_case = test::TestCase<TestEngine>(function);
test_case.add_input<float>({0.68172926, 1.1405563, -0.03931177, -0.03759607}); // X
test_case.add_expected_output<float>(
Shape{2, 1, 1, 2}, {-0.063373, -0.20347191, -0.07230289, -0.13298286}); // Y_data
test_case.add_expected_output<float>(Shape{1, 1, 2}, {-0.07230289, -0.13298286}); // Y_h_data
test_case.add_expected_output<float>(Shape{1, 1, 2}, {-0.1557954, -0.24502525}); // Y_c_data
test_case.run(DEFAULT_FLOAT_TOLERANCE_BITS + 1);
}
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_lstm_reverse_const)
{
auto function = onnx_import::import_onnx_model(
file_util::path_join(SERIALIZED_ZOO, "onnx/lstm_reverse_const.prototxt"));
auto test_case = test::TestCase<TestEngine>(function);
test_case.add_input<float>({0.68172926, 1.1405563, -0.03931177, -0.03759607}); // X
test_case.add_expected_output<float>(
Shape{2, 1, 1, 2}, {-0.06082131, -0.19985214, 0.00860566, 0.00920492}); // Y_data
test_case.add_expected_output<float>(Shape{1, 1, 2}, {-0.06082131, -0.19985214}); // Y_h_data
test_case.add_expected_output<float>(Shape{1, 1, 2}, {-0.25917438, -0.3832652}); // Y_c_data
test_case.run(DEFAULT_FLOAT_TOLERANCE_BITS + 1);
}
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_lstm_bidir_const)
{
auto function = onnx_import::import_onnx_model(
file_util::path_join(SERIALIZED_ZOO, "onnx/lstm_bidir_const.prototxt"));
auto test_case = test::TestCase<TestEngine>(function);
test_case.add_input<float>({0.68172926, 1.1405563, -0.03931177, -0.03759607}); // X
test_case.add_expected_output<float>(Shape{2, 2, 1, 2},
{-0.063373,
-0.20347191,
-0.06082131,
-0.19985214,
-0.07230289,
-0.13298286,
0.00860566,
0.00920492}); // Y_data
test_case.add_expected_output<float>(
Shape{2, 1, 2}, {-0.07230289, -0.13298286, -0.06082131, -0.19985214}); // Y_h_data
test_case.add_expected_output<float>(
Shape{2, 1, 2}, {-0.1557954, -0.24502525, -0.25917438, -0.3832652}); // Y_c_data
test_case.run(DEFAULT_FLOAT_TOLERANCE_BITS + 1);
}
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_with_clip_const)
{
auto function = onnx_import::import_onnx_model(
file_util::path_join(SERIALIZED_ZOO, "onnx/lstm_fwd_clip_const.prototxt"));
auto test_case = test::TestCase<TestEngine>(function);
test_case.add_input<float>({0.68172926, 1.1405563, -0.03931177, -0.03759607}); // X
test_case.add_expected_output<float>(
Shape{2, 1, 1, 2}, {-0.02391884, -0.02744377, -0.01024176, -0.01188637}); // Y_data
test_case.add_expected_output<float>(Shape{1, 1, 2}, {-0.01024176, -0.01188637}); // Y_h_data
test_case.add_expected_output<float>(Shape{1, 1, 2}, {-0.02039271, -0.02353566}); // Y_c_data
test_case.run(DEFAULT_FLOAT_TOLERANCE_BITS + 1);
}
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_mixed_seq_const)
{
auto function = onnx_import::import_onnx_model(
file_util::path_join(SERIALIZED_ZOO, "onnx/lstm_fwd_mixed_seq_const.prototxt"));
auto test_case = test::TestCase<TestEngine>(function);
test_case.add_input<float>({0.68172926, 1.1405563, -0.03931177, -0.03759607}); // X
test_case.add_expected_output<float>(Shape{2, 1, 2, 3},
{0.13528088,
-0.1779867,
-0.07448981,
0.14769037,
-0.16327181,
-0.10419653,
0.,
0.,
0.,
0.08759661,
-0.04002844,
-0.08617793}); // Y_data
test_case.add_expected_output<float>(
Shape{1, 2, 3},
{0.13528088, -0.1779867, -0.07448981, 0.08759661, -0.04002844, -0.08617793}); // Y_h_data
test_case.add_expected_output<float>(
Shape{1, 2, 3},
{0.367563, -0.43762812, -0.20435227, 0.17330585, -0.0732716, -0.18809439}); // Y_c_data
test_case.run(DEFAULT_FLOAT_TOLERANCE_BITS + 1);
}
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_lstm_reverse_mixed_seq_const)
{
auto function = onnx_import::import_onnx_model(
file_util::path_join(SERIALIZED_ZOO, "onnx/lstm_reverse_mixed_seq_const.prototxt"));
auto test_case = test::TestCase<TestEngine>(function);
test_case.add_input<float>({0.68172926, 1.1405563, -0.03931177, -0.03759607}); // X
test_case.add_expected_output<float>(Shape{2, 1, 2, 3},
{0.13528088,
-0.1779867,
-0.07448981,
0.14696799,
-0.15571019,
-0.10270946,
0.,
0.,
0.,
-0.01110403,
0.0228607,
0.00397353}); // Y_data
test_case.add_expected_output<float>(
Shape{1, 2, 3},
{0.13528088, -0.1779867, -0.07448981, 0.14696799, -0.15571019, -0.10270946}); // Y_h_data
test_case.add_expected_output<float>(
Shape{1, 2, 3},
{0.367563, -0.43762812, -0.20435227, 0.50598085, -0.42627674, -0.3641275}); // Y_c_data
test_case.run(DEFAULT_FLOAT_TOLERANCE_BITS + 1);
}
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_with_clip_peepholes)
{
auto function = onnx_import::import_onnx_model(
file_util::path_join(SERIALIZED_ZOO, "onnx/lstm_fwd_with_clip_peepholes.prototxt"));
auto test_case = test::TestCase<TestEngine>(function);
test_case.add_input<float>({-0.455351, -0.276391, -0.185934, -0.269585}); // X
@@ -108,7 +243,7 @@ NGRAPH_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_with_clip)
// We have to enlarge tolerance bits to 3 - it's only one bit more than default value.
// The discrepancies may occur at most on 7th decimal position.
test_case.run(DEFAULT_FLOAT_TOLERANCE_BITS + 1);
test_case.run(DEFAULT_FLOAT_TOLERANCE_BITS + 3);
}
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_mixed_seq)
@@ -251,7 +386,7 @@ NGRAPH_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_large_batch_no_clip)
test_case.run();
}
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_lstm_bdir_short_input_seq)
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_lstm_bdir_short_input_seq_peepholes)
{
auto function = onnx_import::import_onnx_model(
file_util::path_join(SERIALIZED_ZOO, "onnx/lstm_bdir_short_input_seq.prototxt"));

View File

@@ -47,14 +47,6 @@ onnx_model_gatherND_float
# Round op doesn't support some specific cases of rounding
onnx_model_round_half_nearest_even
# LSTMSequence Layer is not instance of RNNLayer class
onnx_model_lstm_fwd_with_clip
onnx_model_lstm_fwd_mixed_seq
onnx_model_lstm_fwd_hardsigmoid_activation
onnx_model_lstm_fwd_large_batch_no_clip
onnx_model_lstm_bdir_short_input_seq
onnx_model_lstm_mixed_seq_reverse
# Result mismatch
onnx_model_split_equal_parts_default
onnx_model_argmin_no_keepdims
@@ -209,6 +201,15 @@ onnx_model_range_positive_step
onnx_model_range_negative_step
onnx_dyn_shapes_slice_1_3d_input_21_axes_ends_max
# LSTMSequence Layer is not instance of RNNLayer class
# (Constant W, B, R inputs are required)
onnx_model_lstm_fwd_with_clip_peepholes
onnx_model_lstm_fwd_mixed_seq
onnx_model_lstm_fwd_hardsigmoid_activation
onnx_model_lstm_fwd_large_batch_no_clip
onnx_model_lstm_bdir_short_input_seq_peepholes
onnx_model_lstm_mixed_seq_reverse
# GRUCell/GRUSequence operation has a form that is not supported
# (Constant W, B, R inputs are required)
IE_CPU.onnx_model_gru_defaults_fwd
@@ -230,7 +231,9 @@ IE_CPU.onnx_model_rnn_reverse
IE_CPU.onnx_model_rnn_fwd_bias_initial_h
IE_CPU.onnx_model_rnn_bidirectional
## RNN/GRU Sequence - seq_lengths are not supported
## RNN/GRU/LSTM Sequence: Output values mismatch - seq_lengths not supported
IE_CPU.onnx_model_lstm_fwd_mixed_seq_const
IE_CPU.onnx_model_lstm_reverse_mixed_seq_const
IE_CPU.onnx_model_rnn_fwd_mixed_seq_len
IE_CPU.onnx_model_rnn_fwd_mixed_seq_len_const
IE_CPU.onnx_model_gru_fwd_mixed_seq_len

View File

@@ -116,26 +116,26 @@ INTERPRETER.onnx_model_gatherND_float
# Round op doesn't support some specific cases of rounding
onnx_model_round_half_nearest_even
# GRU/RNN 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_reverse_mixed_seq_const
onnx_model_lstm_fwd_mixed_seq
onnx_model_lstm_mixed_seq_reverse
onnx_model_gru_fwd_mixed_seq_len
onnx_model_gru_fwd_mixed_seq_len_const
onnx_model_rnn_fwd_mixed_seq_len
onnx_model_rnn_fwd_mixed_seq_len_const
# Unsupported op 'LSTMSequence': not FusedOp anymore, no reference implementation yet
onnx_model_lstm_fwd_with_clip
onnx_model_lstm_fwd_mixed_seq
onnx_model_lstm_fwd_hardsigmoid_activation
onnx_model_lstm_fwd_large_batch_no_clip
onnx_model_lstm_bdir_short_input_seq
onnx_model_lstm_mixed_seq_reverse
# Activation function hardsigmoid is not supported.
gru_cell_activation_function
lstm_cell_activaction_functions
onnx_model_gru_fwd_activations
onnx_model_lstm_fwd_hardsigmoid_activation
# Peepholes, input_forget are not supported
onnx_model_lstm_fwd_with_clip_peepholes
onnx_model_lstm_bdir_short_input_seq_peepholes
lstm_cell_bias_peepholes
lstm_cell_bias_peepholes_clip_input_forget