aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/integration
diff options
context:
space:
mode:
authorLester Solbakken <lesters@oath.com>2020-10-25 12:26:56 +0100
committerLester Solbakken <lesters@oath.com>2020-10-25 12:26:56 +0100
commit38e2a6a325db457456e04ce8385f23b12a5da54d (patch)
treee5e5906f0692831240bd898c9378e948c68a5d02 /config-model/src/test/integration
parent899f7210569b4f43c1531a4f4c12507b41a7f4f7 (diff)
Revert "Revert "Add type resolving for ONNX models""
This reverts commit 882d574ab53e8d10a2a8765a64487c20661dc63f.
Diffstat (limited to 'config-model/src/test/integration')
-rwxr-xr-xconfig-model/src/test/integration/onnx-model/files/create_dynamic_model.py12
-rwxr-xr-xconfig-model/src/test/integration/onnx-model/files/create_model.py37
-rw-r--r--config-model/src/test/integration/onnx-model/files/dynamic_model.onnx13
-rw-r--r--config-model/src/test/integration/onnx-model/files/model.onnx34
-rw-r--r--config-model/src/test/integration/onnx-model/files/summary_model.onnx34
-rw-r--r--config-model/src/test/integration/onnx-model/searchdefinitions/test.sd36
6 files changed, 161 insertions, 5 deletions
diff --git a/config-model/src/test/integration/onnx-model/files/create_dynamic_model.py b/config-model/src/test/integration/onnx-model/files/create_dynamic_model.py
new file mode 100755
index 00000000000..55df3a557e9
--- /dev/null
+++ b/config-model/src/test/integration/onnx-model/files/create_dynamic_model.py
@@ -0,0 +1,12 @@
+# Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+import onnx
+from onnx import helper, TensorProto
+
+INPUT = helper.make_tensor_value_info('input', TensorProto.FLOAT, ["batch", "sequence"])
+OUTPUT = helper.make_tensor_value_info('output', TensorProto.FLOAT, ["batch", "sequence"])
+
+nodes = [helper.make_node('Identity', ['input'], ['output'])]
+graph_def = helper.make_graph( nodes, 'simple_scoring', [INPUT], [OUTPUT])
+model_def = helper.make_model(graph_def, producer_name='create_dynamic_model.py')
+onnx.save(model_def, 'dynamic_model.onnx')
diff --git a/config-model/src/test/integration/onnx-model/files/create_model.py b/config-model/src/test/integration/onnx-model/files/create_model.py
new file mode 100755
index 00000000000..10ff92c2eda
--- /dev/null
+++ b/config-model/src/test/integration/onnx-model/files/create_model.py
@@ -0,0 +1,37 @@
+# Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+import onnx
+from onnx import helper, TensorProto
+
+INPUT_1 = helper.make_tensor_value_info('first_input', TensorProto.FLOAT, [2])
+INPUT_2 = helper.make_tensor_value_info('second/input:0', TensorProto.FLOAT, [2])
+INPUT_3 = helper.make_tensor_value_info('third_input', TensorProto.FLOAT, [2])
+OUTPUT_1 = helper.make_tensor_value_info('path/to/output:0', TensorProto.FLOAT, [2])
+OUTPUT_2 = helper.make_tensor_value_info('path/to/output:1', TensorProto.FLOAT, [2])
+OUTPUT_3 = helper.make_tensor_value_info('path/to/output:2', TensorProto.FLOAT, [2])
+
+nodes = [
+ helper.make_node(
+ 'Add',
+ ['first_input', 'second/input:0'],
+ ['path/to/output:0'],
+ ),
+ helper.make_node(
+ 'Add',
+ ['third_input', 'second/input:0'],
+ ['path/to/output:1']
+ ),
+ helper.make_node(
+ 'Add',
+ ['path/to/output:0', 'path/to/output:1'],
+ ['path/to/output:2']
+ ),
+]
+graph_def = helper.make_graph(
+ nodes,
+ 'simple_scoring',
+ [INPUT_1, INPUT_2, INPUT_3],
+ [OUTPUT_1, OUTPUT_2, OUTPUT_3]
+)
+model_def = helper.make_model(graph_def, producer_name='create_model.py')
+onnx.save(model_def, 'model.onnx')
diff --git a/config-model/src/test/integration/onnx-model/files/dynamic_model.onnx b/config-model/src/test/integration/onnx-model/files/dynamic_model.onnx
new file mode 100644
index 00000000000..6bbdad2d76e
--- /dev/null
+++ b/config-model/src/test/integration/onnx-model/files/dynamic_model.onnx
@@ -0,0 +1,13 @@
+create_dynamic_model.py:x
+
+inputoutput"Identitysimple_scoringZ$
+input
+
+batch
+
+sequenceb%
+output
+
+batch
+
+sequenceB \ No newline at end of file
diff --git a/config-model/src/test/integration/onnx-model/files/model.onnx b/config-model/src/test/integration/onnx-model/files/model.onnx
new file mode 100644
index 00000000000..f3898205c6a
--- /dev/null
+++ b/config-model/src/test/integration/onnx-model/files/model.onnx
@@ -0,0 +1,34 @@
+create_model.py:í
+4
+ first_input
+second/input:0path/to/output:0"Add
+4
+ third_input
+second/input:0path/to/output:1"Add
+;
+path/to/output:0
+path/to/output:1path/to/output:2"Addsimple_scoringZ
+ first_input
+
+
+Z
+second/input:0
+
+
+Z
+ third_input
+
+
+b
+path/to/output:0
+
+
+b
+path/to/output:1
+
+
+b
+path/to/output:2
+
+
+B \ No newline at end of file
diff --git a/config-model/src/test/integration/onnx-model/files/summary_model.onnx b/config-model/src/test/integration/onnx-model/files/summary_model.onnx
new file mode 100644
index 00000000000..f3898205c6a
--- /dev/null
+++ b/config-model/src/test/integration/onnx-model/files/summary_model.onnx
@@ -0,0 +1,34 @@
+create_model.py:í
+4
+ first_input
+second/input:0path/to/output:0"Add
+4
+ third_input
+second/input:0path/to/output:1"Add
+;
+path/to/output:0
+path/to/output:1path/to/output:2"Addsimple_scoringZ
+ first_input
+
+
+Z
+second/input:0
+
+
+Z
+ third_input
+
+
+b
+path/to/output:0
+
+
+b
+path/to/output:1
+
+
+b
+path/to/output:2
+
+
+B \ No newline at end of file
diff --git a/config-model/src/test/integration/onnx-model/searchdefinitions/test.sd b/config-model/src/test/integration/onnx-model/searchdefinitions/test.sd
index 0f0fa694e6f..6e9ba356293 100644
--- a/config-model/src/test/integration/onnx-model/searchdefinitions/test.sd
+++ b/config-model/src/test/integration/onnx-model/searchdefinitions/test.sd
@@ -14,7 +14,7 @@ search test {
}
onnx-model my_model {
- file: files/ranking_model.onnx
+ file: files/model.onnx
input first_input: attribute(document_field)
input "second/input:0": constant(my_constant)
input "third_input": my_function
@@ -22,19 +22,25 @@ search test {
}
onnx-model another_model {
- file: files/ranking_model.onnx
+ file: files/model.onnx
input first_input: attribute(document_field)
input "second/input:0": constant(my_constant)
input "third_input": another_function
output "path/to/output:2": out
}
+ onnx-model dynamic_model {
+ file: files/dynamic_model.onnx
+ input input: my_function
+ output output: my_output
+ }
+
rank-profile test_model_config {
function my_function() {
expression: tensor(d0[2])(1)
}
first-phase {
- expression: onnxModel(my_model).out
+ expression: onnxModel(my_model).out{d0:1}
}
}
@@ -49,7 +55,7 @@ search test {
expression: my_function()
}
first-phase {
- expression: onnxModel("files/ranking_model.onnx", "path/to/output:1")
+ expression: onnxModel("files/model.onnx", "path/to/output:1"){d0:1}
}
}
@@ -62,9 +68,29 @@ search test {
}
summary-features {
onnxModel(another_model).out
- onnxModel("files/ranking_model.onnx", "path/to/output:2")
+ onnxModel("files/summary_model.onnx", "path/to/output:2")
+ }
+ }
+
+ rank-profile test_dynamic_model {
+ function my_function() {
+ expression: tensor(d0[1],d1[2])(d1)
+ }
+ first-phase {
+ expression: onnxModel(dynamic_model){d0:0,d1:1}
}
+ }
+ rank-profile test_dynamic_model_2 {
+ function my_function_2() {
+ expression: tensor(d0[1],d1[3])(d1)
+ }
+ function my_function() {
+ expression: my_function_2()
+ }
+ first-phase {
+ expression: onnxModel(dynamic_model){d0:0,d1:2}
+ }
}
}