diff options
Diffstat (limited to 'tests/nnapi/specs/Ex')
111 files changed, 2475 insertions, 0 deletions
diff --git a/tests/nnapi/specs/Ex/argmax_ex_float_1.mod.py b/tests/nnapi/specs/Ex/argmax_ex_float_1.mod.py new file mode 100644 index 000000000..e2255e004 --- /dev/null +++ b/tests/nnapi/specs/Ex/argmax_ex_float_1.mod.py @@ -0,0 +1,18 @@ +model = Model() +i1 = Input("input", "TENSOR_FLOAT32", "{1, 2, 2, 1}") +axis = Parameter("axis", "TENSOR_INT32", "{1}", [1]) +output = Output("output", "TENSOR_INT32", "{1, 1, 2, 1}") + +model = model.Operation("ARGMAX_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1.0, 4.0, + 2.0, 3.0]} + +output0 = {output: # output 0 + [1, + 0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/argmax_ex_float_2.mod.py b/tests/nnapi/specs/Ex/argmax_ex_float_2.mod.py new file mode 100644 index 000000000..6f06bfd0b --- /dev/null +++ b/tests/nnapi/specs/Ex/argmax_ex_float_2.mod.py @@ -0,0 +1,18 @@ +model = Model() +i1 = Input("input", "TENSOR_FLOAT32", "{1, 2, 2, 2}") +axis = Parameter("axis", "TENSOR_INT32", "{1}", [3]) +output = Output("output", "TENSOR_INT32", "{1, 2, 2, 1}") + +model = model.Operation("ARGMAX_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1.0, 2.0, 7.0, 8.0, + 1.0, 9.0, 7.0, 3.0]} + +output0 = {output: # output 0 + [1,1, + 1,0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/argmax_ex_int32.mod.py b/tests/nnapi/specs/Ex/argmax_ex_int32.mod.py new file mode 100644 index 000000000..f7f98afe2 --- /dev/null +++ b/tests/nnapi/specs/Ex/argmax_ex_int32.mod.py @@ -0,0 +1,18 @@ +model = Model() +i1 = Input("input", "TENSOR_INT32", "{1, 2, 2, 1}") +axis = Parameter("axis", "TENSOR_INT32", "{1}", [1]) +output = Output("output", "TENSOR_INT32", "{1, 1, 2, 1}") + +model = model.Operation("ARGMAX_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1, 4, + 2, 3]} + +output0 = {output: # output 0 + [1, + 0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/argmax_ex_neg_axis_float.mod.py b/tests/nnapi/specs/Ex/argmax_ex_neg_axis_float.mod.py new file mode 100644 index 000000000..b29cf1eb6 --- /dev/null +++ b/tests/nnapi/specs/Ex/argmax_ex_neg_axis_float.mod.py @@ -0,0 +1,17 @@ +model = Model() +i1 = Input("input", "TENSOR_FLOAT32", "{1, 2, 4, 1}") +axis = Parameter("axis", "TENSOR_INT32", "{1}", [-3]) +output = Output("output", "TENSOR_INT32", "{1, 1, 4, 1}") + +model = model.Operation("ARGMAX_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1.0, 2.0, 7.0, 8.0, + 1.0, 9.0, 7.0, 3.0]} + +output0 = {output: # output 0 + [0, 1, 0, 0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/argmax_ex_neg_axis_int32.mod.py b/tests/nnapi/specs/Ex/argmax_ex_neg_axis_int32.mod.py new file mode 100644 index 000000000..ddc27b35a --- /dev/null +++ b/tests/nnapi/specs/Ex/argmax_ex_neg_axis_int32.mod.py @@ -0,0 +1,17 @@ +model = Model() +i1 = Input("input", "TENSOR_INT32", "{1, 2, 4, 1}") +axis = Parameter("axis", "TENSOR_INT32", "{1}", [-3]) +output = Output("output", "TENSOR_INT32", "{1, 1, 4, 1}") + +model = model.Operation("ARGMAX_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1, 2, 7, 8, + 1, 9, 7, 3]} + +output0 = {output: # output 0 + [0, 1, 0, 0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/argmax_ex_quant8.mod.py b/tests/nnapi/specs/Ex/argmax_ex_quant8.mod.py new file mode 100644 index 000000000..fd3c5230b --- /dev/null +++ b/tests/nnapi/specs/Ex/argmax_ex_quant8.mod.py @@ -0,0 +1,18 @@ +model = Model() +i1 = Input("input", "TENSOR_QUANT8_ASYMM", "{1, 2, 2, 1}, 0.5f, 2") +axis = Parameter("axis", "TENSOR_INT32", "{1}", [1]) +output = Output("output", "TENSOR_INT32", "{1, 1, 2, 1}") + +model = model.Operation("ARGMAX_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1, 4, + 2, 3]} + +output0 = {output: # output 0 + [1, + 0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/argmax_ex_quant8_neg_axis.mod.py b/tests/nnapi/specs/Ex/argmax_ex_quant8_neg_axis.mod.py new file mode 100644 index 000000000..c7ddc0e5d --- /dev/null +++ b/tests/nnapi/specs/Ex/argmax_ex_quant8_neg_axis.mod.py @@ -0,0 +1,17 @@ +model = Model() +i1 = Input("input", "TENSOR_QUANT8_ASYMM", "{1, 2, 4, 1}, 0.5f, 5") +axis = Parameter("axis", "TENSOR_INT32", "{1}", [-3]) +output = Output("output", "TENSOR_INT32", "{1, 1, 4, 1}") + +model = model.Operation("ARGMAX_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1, 2, 7, 8, + 1, 9, 7, 3]} + +output0 = {output: # output 0 + [0, 1, 0, 0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/cast_ex_float32_to_int32.mod.py b/tests/nnapi/specs/Ex/cast_ex_float32_to_int32.mod.py new file mode 100644 index 000000000..8f94fb8ae --- /dev/null +++ b/tests/nnapi/specs/Ex/cast_ex_float32_to_int32.mod.py @@ -0,0 +1,15 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{2, 3}") +i2 = Output("op2", "TENSOR_INT32", "{2, 3}") +model = model.Operation("CAST_EX", i1).To(i2) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [100.0, 20.0, 3.0, 0.4, 0.999, 1.1]} + +output0 = {i2: # output 0 + [100, 20, 3, 0, 0, 1]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/cast_ex_int32_to_float32.mod.py b/tests/nnapi/specs/Ex/cast_ex_int32_to_float32.mod.py new file mode 100644 index 000000000..4a85dc9c5 --- /dev/null +++ b/tests/nnapi/specs/Ex/cast_ex_int32_to_float32.mod.py @@ -0,0 +1,15 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_INT32", "{2, 3}") +i2 = Output("op2", "TENSOR_FLOAT32", "{2, 3}") +model = model.Operation("CAST_EX", i1).To(i2) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [100, 200, 300, 400, 500, 600]} + +output0 = {i2: # output 0 + [100.0, 200.0, 300.0, 400.0, 500.0, 600.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/equal_ex_1D_float.mod.py b/tests/nnapi/specs/Ex/equal_ex_1D_float.mod.py new file mode 100644 index 000000000..f2ec16789 --- /dev/null +++ b/tests/nnapi/specs/Ex/equal_ex_1D_float.mod.py @@ -0,0 +1,18 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{3}") # a vector of input +i2 = Input("op2", "TENSOR_FLOAT32", "{3}") # a vector of input +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{3}, 1.f, 0") # a vector of output +model = model.Operation("EQUAL_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [2.0, 3.254232, 5.1232], + i2: # input 1 + [2.0, 3.254111, 5.1232]} + +output0 = {i3: # output 0 + [255, 0, 255]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/equal_ex_4D_float.mod.py b/tests/nnapi/specs/Ex/equal_ex_4D_float.mod.py new file mode 100644 index 000000000..f804a5066 --- /dev/null +++ b/tests/nnapi/specs/Ex/equal_ex_4D_float.mod.py @@ -0,0 +1,18 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{1, 2, 2, 1}") # a vector of input +i2 = Input("op2", "TENSOR_FLOAT32", "{1, 2, 2, 1}") # a vector of input +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{1, 2, 2, 1}, 1.f, 0") # a vector of output +model = model.Operation("EQUAL_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [0, 1543.25454532, 5.1232, 10.1], + i2: # input 1 + [0, 5313.25414521, 5.1, 10.1]} + +output0 = {i3: # output 0 + [255, 0, 0, 255]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/equal_ex_broadcast_4D_2D_float.mod.py b/tests/nnapi/specs/Ex/equal_ex_broadcast_4D_2D_float.mod.py new file mode 100644 index 000000000..5e31698a9 --- /dev/null +++ b/tests/nnapi/specs/Ex/equal_ex_broadcast_4D_2D_float.mod.py @@ -0,0 +1,30 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{3, 2, 2, 2}") +i2 = Input("op2", "TENSOR_FLOAT32", "{2, 2}") + +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{3, 2, 2, 2}, 1.f, 0") +model = model.Operation("EQUAL_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [4.89, 11.0, 9.75, 10.20, + 8.25, 2.0, 1.15, 0.0, + 3.0, 1.0, 8.25, 6.0, + 8.45, 3.0, 8.25, 1.2, + 0.0, 3.0, 2.0, 7.34, + 4.3, 9.56, 11.0, 3.0], + i2: # input 1 + [8.25, 3.0, 2.0, 10.20]} + +output0 = {i3: # output 0 + [0, 0, 0, 255, + 255, 0, 0, 0, + 0, 0, 0, 0, + 0, 255, 0, 0, + 0, 255, 255, 0, + 0, 0, 0, 0] + } + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/equal_ex_broadcast_float.mod.py b/tests/nnapi/specs/Ex/equal_ex_broadcast_float.mod.py new file mode 100644 index 000000000..279c000ba --- /dev/null +++ b/tests/nnapi/specs/Ex/equal_ex_broadcast_float.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{2, 2}") +i2 = Input("op2", "TENSOR_FLOAT32", "{1, 2}") + +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{2, 2}, 1.f, 0") +model = model.Operation("EQUAL_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [7.45, 3.21, 2.0, 7.67], + i2: # input 1 + [0.0, 7.67]} + +output0 = {i3: # output 0 + [0, 0, 0, 255]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/equal_ex_quant8.mod.py b/tests/nnapi/specs/Ex/equal_ex_quant8.mod.py new file mode 100644 index 000000000..a799c6f42 --- /dev/null +++ b/tests/nnapi/specs/Ex/equal_ex_quant8.mod.py @@ -0,0 +1,18 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{3}, 1.f, 0") # a vector of input +i2 = Input("op2", "TENSOR_QUANT8_ASYMM", "{3}, 1.f, 0") # a vector of input +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{3}, 1.f, 0") # a vector of output +model = model.Operation("EQUAL_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [2, 3, 0], + i2: # input 1 + [2, 9, 0]} + +output0 = {i3: # output 0 + [255, 0, 255]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/exp_ex_1D_float.mod.py b/tests/nnapi/specs/Ex/exp_ex_1D_float.mod.py new file mode 100644 index 000000000..1979b0aec --- /dev/null +++ b/tests/nnapi/specs/Ex/exp_ex_1D_float.mod.py @@ -0,0 +1,15 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{4}") # a vector of 4 float32s +i2 = Output("op2", "TENSOR_FLOAT32", "{4}") # a vector of 4 float32s +model = model.Operation("EXP_EX", i1).To(i2) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [3.0, 4.0, 5.0, 6.0]} + +output0 = {i2: # output 0 + [20.085537, 54.59815, 148.41316, 403.4288]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/exp_ex_2D_float.mod.py b/tests/nnapi/specs/Ex/exp_ex_2D_float.mod.py new file mode 100644 index 000000000..a79ca9a8a --- /dev/null +++ b/tests/nnapi/specs/Ex/exp_ex_2D_float.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{3,4}") # a vector of 12 float32s +i2 = Output("op2", "TENSOR_FLOAT32", "{3,4}") # a vector of 12 float32s +model = model.Operation("EXP_EX", i1).To(i2) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [3.123456789123456789, 4.123456789123456789, 5.123456789123456789, 6.123456789123456789, + 7.123456789123456789, 8.123456789123456789, 9.123456789123456789, 1.123456789123456789, + 2.123456789123456789, 18.123456789123456789, 19.123456789123456789, 11.123456789123456789]} + +output0 = {i2: # output 0 + [2.2724796e+01, 6.1772419e+01, 1.6791484e+02, 4.5643985e+02, + 1.2407322e+03, 3.3726597e+03, 9.1678398e+03, 3.0754671e+00, + 8.3599854e+00, 7.4287776e+07, 2.0193510e+08, 6.7741680e+04]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/exp_ex_3D_float.mod.py b/tests/nnapi/specs/Ex/exp_ex_3D_float.mod.py new file mode 100644 index 000000000..c9e30e099 --- /dev/null +++ b/tests/nnapi/specs/Ex/exp_ex_3D_float.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{2,3,2}") +i2 = Output("op2", "TENSOR_FLOAT32", "{2,3,2}") +model = model.Operation("EXP_EX", i1).To(i2) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [3.123456789123456789, 4.123456789123456789, 5.123456789123456789, 6.123456789123456789, + 7.123456789123456789, 8.123456789123456789, 9.123456789123456789, 1.123456789123456789, + 2.123456789123456789, 18.123456789123456789, 19.123456789123456789, 11.123456789123456789]} + +output0 = {i2: # output 0 + [2.2724796e+01, 6.1772419e+01, 1.6791484e+02, 4.5643985e+02, + 1.2407322e+03, 3.3726597e+03, 9.1678398e+03, 3.0754671e+00, + 8.3599854e+00, 7.4287776e+07, 2.0193510e+08, 6.7741680e+04]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/exp_ex_4D_float.mod.py b/tests/nnapi/specs/Ex/exp_ex_4D_float.mod.py new file mode 100644 index 000000000..d7b777d95 --- /dev/null +++ b/tests/nnapi/specs/Ex/exp_ex_4D_float.mod.py @@ -0,0 +1,31 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{2,3,2,3}") +i2 = Output("op2", "TENSOR_FLOAT32", "{2,3,2,3}") +model = model.Operation("EXP_EX", i1).To(i2) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [3.123456789123456789, 4.123456789123456789, 5.123456789123456789, 6.123456789123456789, + 7.123456789123456789, 8.123456789123456789, 9.123456789123456789, 1.123456789123456789, + 2.123456789123456789, 18.123456789123456789, 19.123456789123456789, 11.123456789123456789, + 7.123456789123456789, 8.123456789123456789, 9.123456789123456789, 1.123456789123456789, + 3.123456789123456789, 4.123456789123456789, 5.123456789123456789, 6.123456789123456789, + 3.123456789123456789, 4.123456789123456789, 5.123456789123456789, 6.123456789123456789, + 2.123456789123456789, 18.123456789123456789, 19.123456789123456789, 11.123456789123456789, + 7.123456789123456789, 8.123456789123456789, 9.123456789123456789, 1.123456789123456789, + 2.123456789123456789, 18.123456789123456789, 19.123456789123456789, 11.123456789123456789]} + +output0 = {i2: # output 0 + [2.2724796e+01, 6.1772419e+01, 1.6791484e+02, 4.5643985e+02, + 1.2407322e+03, 3.3726597e+03, 9.1678398e+03, 3.0754671e+00, + 8.3599854e+00, 7.4287776e+07, 2.0193510e+08, 6.7741680e+04, + 1.2407322e+03, 3.3726597e+03, 9.1678398e+03, 3.0754671e+00, + 2.2724796e+01, 6.1772419e+01, 1.6791484e+02, 4.5643985e+02, + 2.2724796e+01, 6.1772419e+01, 1.6791484e+02, 4.5643985e+02, + 8.3599854e+00, 7.4287776e+07, 2.0193510e+08, 6.7741680e+04, + 1.2407322e+03, 3.3726597e+03, 9.1678398e+03, 3.0754671e+00, + 8.3599854e+00, 7.4287776e+07, 2.0193510e+08, 6.7741680e+04]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/gather_ex_1D_float.mod.py b/tests/nnapi/specs/Ex/gather_ex_1D_float.mod.py new file mode 100644 index 000000000..eed3bf92d --- /dev/null +++ b/tests/nnapi/specs/Ex/gather_ex_1D_float.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{4}") # a vector of 4 float32s +i2 = Input("op2", "TENSOR_INT32", "{2}") # another vector of 2 int32s +axis = Int32Scalar("axis", 0) +i3 = Output("op3", "TENSOR_FLOAT32", "{2}") # a vector of 2 float32s +model = model.Operation("GATHER_EX", i1, i2, axis).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [3.0, 4.0, 5.0, 6.0], + i2: # input 1 + [2, 0]} + +output0 = {i3: # output 0 + [5.0, 3.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/gather_ex_1D_int32.mod.py b/tests/nnapi/specs/Ex/gather_ex_1D_int32.mod.py new file mode 100644 index 000000000..0eefbea58 --- /dev/null +++ b/tests/nnapi/specs/Ex/gather_ex_1D_int32.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_INT32", "{4}") # a vector of 4 int32s +i2 = Input("op2", "TENSOR_INT32", "{2}") # another vector of 2 int32s +axis = Int32Scalar("axis", 0) +i3 = Output("op3", "TENSOR_INT32", "{2}") # a vector of 2 int32s +model = model.Operation("GATHER_EX", i1, i2, axis).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [40000, 41000, 50000, 60000], + i2: # input 1 + [2, 0]} + +output0 = {i3: # output 0 + [50000, 40000]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/gather_ex_1D_quant8.mod.py b/tests/nnapi/specs/Ex/gather_ex_1D_quant8.mod.py new file mode 100644 index 000000000..f3276162f --- /dev/null +++ b/tests/nnapi/specs/Ex/gather_ex_1D_quant8.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{4}, 0.5f, 1") # a vector of 4 qasymm8s +i2 = Input("op2", "TENSOR_INT32", "{2}") # another vector of 2 int32s +axis = Int32Scalar("axis", 0) +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{2}, 0.5f, 1") # another vector of 2 qasymm8s +model = model.Operation("GATHER_EX", i1, i2, axis).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [7, 9, 11, 13], + i2: # input 1 + [2, 0]} + +output0 = {i3: # output 0 + [11, 7]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/gather_ex_2D_float.mod.py b/tests/nnapi/specs/Ex/gather_ex_2D_float.mod.py new file mode 100644 index 000000000..52f7bf12f --- /dev/null +++ b/tests/nnapi/specs/Ex/gather_ex_2D_float.mod.py @@ -0,0 +1,22 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{3,4}") # a vector of 12 float32s +i2 = Input("op2", "TENSOR_INT32", "{2}") # another vector of 2 int32s +axis = Int32Scalar("axis", 0) +i3 = Output("op3", "TENSOR_FLOAT32", "{2,4}") # a vector of 8 float32s +model = model.Operation("GATHER_EX", i1, i2, axis).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [3.123456789123456789, 4.123456789123456789, 5.123456789123456789, 6.123456789123456789, + 7.123456789123456789, 8.123456789123456789, 9.123456789123456789, 1.123456789123456789, + 2.123456789123456789, 18.123456789123456789, 19.123456789123456789, 11.123456789123456789], + i2: # input 1 + [2, 0]} + +output0 = {i3: # output 0 + [2.123456789123456789, 18.123456789123456789, 19.123456789123456789, 11.123456789123456789, + 3.123456789123456789, 4.123456789123456789, 5.123456789123456789, 6.123456789123456789]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/gather_ex_2D_int32.mod.py b/tests/nnapi/specs/Ex/gather_ex_2D_int32.mod.py new file mode 100644 index 000000000..357efd08f --- /dev/null +++ b/tests/nnapi/specs/Ex/gather_ex_2D_int32.mod.py @@ -0,0 +1,22 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_INT32", "{3,4}") # a vector of 12 int32s +i2 = Input("op2", "TENSOR_INT32", "{2}") # another vector of 2 int32s +axis = Int32Scalar("axis", 0) +i3 = Output("op3", "TENSOR_INT32", "{2,4}") # a vector of 8 int32s +model = model.Operation("GATHER_EX", i1, i2, axis).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [40000, 41000, 50000, 60000, + 70000, 80000, 90000, 79000, + 170000, 180000, 190000, 110000], + i2: # input 1 + [2, 0]} + +output0 = {i3: # output 0 + [170000, 180000, 190000, 110000, + 40000, 41000, 50000, 60000]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/gather_ex_2D_quant8.mod.py b/tests/nnapi/specs/Ex/gather_ex_2D_quant8.mod.py new file mode 100644 index 000000000..8e4eb04ec --- /dev/null +++ b/tests/nnapi/specs/Ex/gather_ex_2D_quant8.mod.py @@ -0,0 +1,22 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{3,4}, 0.5f, 1") # a vector of 12 qasymm8s +i2 = Input("op2", "TENSOR_INT32", "{2}") # another vector of 2 int32s +axis = Int32Scalar("axis", 0) +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{2,4}, 0.5f, 1") # a vector of 8 qasymm8s +model = model.Operation("GATHER_EX", i1, i2, axis).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [7, 9, 11, 13, + 15, 17, 19, 3, + 5, 37, 39, 23], + i2: # input 1 + [2, 0]} + +output0 = {i3: # output 0 + [5, 37, 39, 23, + 7, 9, 11, 13]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/logical_and_ex_1D.mod.py b/tests/nnapi/specs/Ex/logical_and_ex_1D.mod.py new file mode 100644 index 000000000..0f474f94e --- /dev/null +++ b/tests/nnapi/specs/Ex/logical_and_ex_1D.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{4}, 1.f, 0") +i2 = Input("op2", "TENSOR_QUANT8_ASYMM", "{4}, 1.f, 0") + +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{4}, 1.f, 0") +model = model.Operation("LOGICAL_AND_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [0, 0, 255, 255], + i2: # input 255 + [0, 255, 0, 255]} + +output0 = {i3: # output 0 + [0, 0, 0, 255]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/logical_and_ex_2D.mod.py b/tests/nnapi/specs/Ex/logical_and_ex_2D.mod.py new file mode 100644 index 000000000..eea915d69 --- /dev/null +++ b/tests/nnapi/specs/Ex/logical_and_ex_2D.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{2, 2}, 1.f, 0") +i2 = Input("op2", "TENSOR_QUANT8_ASYMM", "{2, 2}, 1.f, 0") + +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{2, 2}, 1.f, 0") +model = model.Operation("LOGICAL_AND_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [0, 0, 255, 255], + i2: # input 1 + [0, 255, 0, 255]} + +output0 = {i3: # output 0 + [0, 0, 0, 255]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/logical_and_ex_3D.mod.py b/tests/nnapi/specs/Ex/logical_and_ex_3D.mod.py new file mode 100644 index 000000000..dccc4f0de --- /dev/null +++ b/tests/nnapi/specs/Ex/logical_and_ex_3D.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{2, 2, 2}, 1.f, 0") +i2 = Input("op2", "TENSOR_QUANT8_ASYMM", "{2, 2, 2}, 1.f, 0") + +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{2, 2, 2}, 1.f, 0") +model = model.Operation("LOGICAL_AND_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [0, 0, 255, 255, 0, 255, 0, 255], + i2: # input 1 + [0, 255, 0, 255, 0, 0, 255, 255]} + +output0 = {i3: # output 0 + [0, 0, 0, 255, 0, 0, 0, 255]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/logical_and_ex_4D.mod.py b/tests/nnapi/specs/Ex/logical_and_ex_4D.mod.py new file mode 100644 index 000000000..dceb275c7 --- /dev/null +++ b/tests/nnapi/specs/Ex/logical_and_ex_4D.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{2, 1, 2, 2}, 1.f, 0") +i2 = Input("op2", "TENSOR_QUANT8_ASYMM", "{2, 1, 2, 2}, 1.f, 0") + +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{2, 1, 2, 2}, 1.f, 0") +model = model.Operation("LOGICAL_AND_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [0, 0, 255, 255, 0, 255, 0, 255], + i2: # input 1 + [0, 255, 0, 255, 0, 0, 255, 255]} + +output0 = {i3: # output 0 + [0, 0, 0, 255, 0, 0, 0, 255]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/logical_and_ex_broadcast.mod.py b/tests/nnapi/specs/Ex/logical_and_ex_broadcast.mod.py new file mode 100644 index 000000000..45d899235 --- /dev/null +++ b/tests/nnapi/specs/Ex/logical_and_ex_broadcast.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{1, 2, 2, 1}, 1.f, 0") +i2 = Input("op2", "TENSOR_QUANT8_ASYMM", "{1, 1, 2, 1}, 1.f, 0") + +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{1, 2, 2, 1}, 1.f, 0") +model = model.Operation("LOGICAL_AND_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [0, 0, 255, 255], + i2: # input 1 + [0, 255]} + +output0 = {i3: # output 0 + [0, 0, 0, 255]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/logical_and_ex_broadcast_4D_2D.mod.py b/tests/nnapi/specs/Ex/logical_and_ex_broadcast_4D_2D.mod.py new file mode 100644 index 000000000..9235f7fdb --- /dev/null +++ b/tests/nnapi/specs/Ex/logical_and_ex_broadcast_4D_2D.mod.py @@ -0,0 +1,25 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{2, 2, 2, 2}, 1.f, 0") +i2 = Input("op2", "TENSOR_QUANT8_ASYMM", "{2, 2}, 1.f, 0") + +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{2, 2, 2, 2}, 1.f, 0") +model = model.Operation("LOGICAL_AND_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [0, 0, 255, 255, + 255, 255, 0, 0, + 0, 0, 0, 0, + 255, 255, 255, 255], + i2: # input 1 + [0, 255, 0, 255]} + +output0 = {i3: # output 0 + [0, 0, 0, 255, + 0, 255, 0, 0, + 0, 0, 0, 0, + 0, 255, 0, 255]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/logical_not_ex_1D.mod.py b/tests/nnapi/specs/Ex/logical_not_ex_1D.mod.py new file mode 100644 index 000000000..a913b1997 --- /dev/null +++ b/tests/nnapi/specs/Ex/logical_not_ex_1D.mod.py @@ -0,0 +1,16 @@ +# model +model = Model() +i = Input("op1", "TENSOR_QUANT8_ASYMM", "{4}, 1.f, 0") + +o = Output("op2", "TENSOR_QUANT8_ASYMM", "{4}, 1.f, 0") +model = model.Operation("LOGICAL_NOT_EX", i).To(o) + +# Example 1. Input +input0 = {i: # input + [255, 0, 255, 255]} + +output0 = {o: # output + [0, 255, 0, 0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/logical_not_ex_4D.mod.py b/tests/nnapi/specs/Ex/logical_not_ex_4D.mod.py new file mode 100644 index 000000000..49306fc51 --- /dev/null +++ b/tests/nnapi/specs/Ex/logical_not_ex_4D.mod.py @@ -0,0 +1,16 @@ +# model +model = Model() +i = Input("op1", "TENSOR_QUANT8_ASYMM", "{1, 2, 2, 1}, 1.f, 0") # a vector of input + +o = Output("op2", "TENSOR_QUANT8_ASYMM", "{1, 2, 2, 1}, 1.f, 0") # a vector of output +model = model.Operation("LOGICAL_NOT_EX", i).To(o) + +# Example 1. Input +input0 = {i: # input + [0, 255, 255, 255]} + +output0 = {o: # output + [255, 0, 0, 0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/logical_or_ex_1D.mod.py b/tests/nnapi/specs/Ex/logical_or_ex_1D.mod.py new file mode 100644 index 000000000..48e6d8ec3 --- /dev/null +++ b/tests/nnapi/specs/Ex/logical_or_ex_1D.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{4}, 1.f, 0") +i2 = Input("op2", "TENSOR_QUANT8_ASYMM", "{4}, 1.f, 0") + +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{4}, 1.f, 0") +model = model.Operation("LOGICAL_OR_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [0, 0, 255, 255], + i2: # input 255 + [0, 255, 0, 255]} + +output0 = {i3: # output 0 + [0, 255, 255, 255]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/logical_or_ex_2D.mod.py b/tests/nnapi/specs/Ex/logical_or_ex_2D.mod.py new file mode 100644 index 000000000..5a6517170 --- /dev/null +++ b/tests/nnapi/specs/Ex/logical_or_ex_2D.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{2, 2}, 1.f, 0") +i2 = Input("op2", "TENSOR_QUANT8_ASYMM", "{2, 2}, 1.f, 0") + +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{2, 2}, 1.f, 0") +model = model.Operation("LOGICAL_OR_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [0, 0, 255, 255], + i2: # input 1 + [0, 255, 0, 255]} + +output0 = {i3: # output 0 + [0, 255, 255, 255]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/logical_or_ex_3D.mod.py b/tests/nnapi/specs/Ex/logical_or_ex_3D.mod.py new file mode 100644 index 000000000..06fbbe65d --- /dev/null +++ b/tests/nnapi/specs/Ex/logical_or_ex_3D.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{2, 2, 2}, 1.f, 0") +i2 = Input("op2", "TENSOR_QUANT8_ASYMM", "{2, 2, 2}, 1.f, 0") + +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{2, 2, 2}, 1.f, 0") +model = model.Operation("LOGICAL_OR_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [0, 0, 255, 255, 0, 255, 0, 255], + i2: # input 1 + [0, 255, 0, 255, 0, 0, 255, 255]} + +output0 = {i3: # output 0 + [0, 255, 255, 255, 0, 255, 255, 255]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/logical_or_ex_4D.mod.py b/tests/nnapi/specs/Ex/logical_or_ex_4D.mod.py new file mode 100644 index 000000000..f6833c96e --- /dev/null +++ b/tests/nnapi/specs/Ex/logical_or_ex_4D.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{2, 1, 2, 2}, 1.f, 0") +i2 = Input("op2", "TENSOR_QUANT8_ASYMM", "{2, 1, 2, 2}, 1.f, 0") + +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{2, 1, 2, 2}, 1.f, 0") +model = model.Operation("LOGICAL_OR_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [0, 0, 255, 255, 0, 255, 0, 255], + i2: # input 1 + [0, 255, 0, 255, 0, 0, 255, 255]} + +output0 = {i3: # output 0 + [0, 255, 255, 255, 0, 255, 255, 255]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/logical_or_ex_broadcast.mod.py b/tests/nnapi/specs/Ex/logical_or_ex_broadcast.mod.py new file mode 100644 index 000000000..89c8310bb --- /dev/null +++ b/tests/nnapi/specs/Ex/logical_or_ex_broadcast.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{1, 2, 2, 1}, 1.f, 0") +i2 = Input("op2", "TENSOR_QUANT8_ASYMM", "{1, 1, 2, 1}, 1.f, 0") + +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{1, 2, 2, 1}, 1.f, 0") +model = model.Operation("LOGICAL_OR_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [0, 0, 255, 255], + i2: # input 1 + [0, 255]} + +output0 = {i3: # output 0 + [0, 255, 255, 255]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/logical_or_ex_broadcast_4D_2D.mod.py b/tests/nnapi/specs/Ex/logical_or_ex_broadcast_4D_2D.mod.py new file mode 100644 index 000000000..a673494e5 --- /dev/null +++ b/tests/nnapi/specs/Ex/logical_or_ex_broadcast_4D_2D.mod.py @@ -0,0 +1,25 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{2, 2, 2, 2}, 1.f, 0") +i2 = Input("op2", "TENSOR_QUANT8_ASYMM", "{2, 2}, 1.f, 0") + +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{2, 2, 2, 2}, 1.f, 0") +model = model.Operation("LOGICAL_OR_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [0, 0, 255, 255, + 255, 255, 0, 0, + 0, 0, 0, 0, + 255, 255, 255, 255], + i2: # input 1 + [0, 255, 0, 255]} + +output0 = {i3: # output 0 + [0, 255, 255, 255, + 255, 255, 0, 255, + 0, 255, 0, 255, + 255, 255, 255, 255]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/neg_ex_1D_float.mod.py b/tests/nnapi/specs/Ex/neg_ex_1D_float.mod.py new file mode 100644 index 000000000..d66298099 --- /dev/null +++ b/tests/nnapi/specs/Ex/neg_ex_1D_float.mod.py @@ -0,0 +1,15 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{4}") # a vector of input +i2 = Output("op2", "TENSOR_FLOAT32", "{4}") # a vector of output +model = model.Operation("NEG_EX", i1).To(i2) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [3.0, 4.0, 5.0, 6.0]} + +output0 = {i2: # output 0 + [-3.0, -4.0, -5.0, -6.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/neg_ex_2D_float.mod.py b/tests/nnapi/specs/Ex/neg_ex_2D_float.mod.py new file mode 100644 index 000000000..829fedea8 --- /dev/null +++ b/tests/nnapi/specs/Ex/neg_ex_2D_float.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{3,4}") +i2 = Output("op2", "TENSOR_FLOAT32", "{3,4}") +model = model.Operation("NEG_EX", i1).To(i2) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [3.123456789123456789, 4.123456789123456789, 5.123456789123456789, 6.123456789123456789, + 7.123456789123456789, 8.123456789123456789, 9.123456789123456789, 1.123456789123456789, + 2.123456789123456789, 18.123456789123456789, 19.123456789123456789, 11.123456789123456789]} + +output0 = {i2: # output 0 + [-3.123456789123456789, -4.123456789123456789, -5.123456789123456789, -6.123456789123456789, + -7.123456789123456789, -8.123456789123456789, -9.123456789123456789, -1.123456789123456789, + -2.123456789123456789, -18.123456789123456789, -19.123456789123456789, -11.123456789123456789]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/neg_ex_3D_float.mod.py b/tests/nnapi/specs/Ex/neg_ex_3D_float.mod.py new file mode 100644 index 000000000..1f57c49f2 --- /dev/null +++ b/tests/nnapi/specs/Ex/neg_ex_3D_float.mod.py @@ -0,0 +1,25 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{2,3,4}") +i2 = Output("op2", "TENSOR_FLOAT32", "{2,3,4}") +model = model.Operation("NEG_EX", i1).To(i2) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [3.123456789123456789, 4.123456789123456789, 5.123456789123456789, 6.123456789123456789, + 7.123456789123456789, 8.123456789123456789, 9.123456789123456789, 1.123456789123456789, + 2.123456789123456789, 18.123456789123456789, 19.123456789123456789, 11.123456789123456789, + 40.123456789123456789, 42.123456789123456789, 4.123456789123456789, 12.123456789123456789, + 22.123456789123456789, 32.123456789123456789, 62.123456789123456789, 52.123456789123456789, + 92.123456789123456789, 59.123456789123456789, 69.123456789123456789, 312.123456789123456789]} + +output0 = {i2: # output 0 + [-3.123456789123456789, -4.123456789123456789, -5.123456789123456789, -6.123456789123456789, + -7.123456789123456789, -8.123456789123456789, -9.123456789123456789, -1.123456789123456789, + -2.123456789123456789, -18.123456789123456789, -19.123456789123456789, -11.123456789123456789, + -40.123456789123456789, -42.123456789123456789, -4.123456789123456789, -12.123456789123456789, + -22.123456789123456789, -32.123456789123456789, -62.123456789123456789, -52.123456789123456789, + -92.123456789123456789, -59.123456789123456789, -69.123456789123456789, -312.123456789123456789]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/neg_ex_3D_int.mod.py b/tests/nnapi/specs/Ex/neg_ex_3D_int.mod.py new file mode 100644 index 000000000..56dbec1d7 --- /dev/null +++ b/tests/nnapi/specs/Ex/neg_ex_3D_int.mod.py @@ -0,0 +1,25 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_INT32", "{2,3,4}") +i2 = Output("op2", "TENSOR_INT32", "{2,3,4}") +model = model.Operation("NEG_EX", i1).To(i2) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [3, 4, 5, 6, + 7, 8, 9, 1, + 2, 18, 19, 11, + 40, 42, 4, 12, + 22, 32, 62, 52, + 92, 59, 69, 312]} + +output0 = {i2: # output 0 + [-3, -4, -5, -6, + -7, -8, -9, -1, + -2, -18, -19, -11, + -40, -42, -4, -12, + -22, -32, -62, -52, + -92, -59, -69, -312]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/neg_ex_4D_float.mod.py b/tests/nnapi/specs/Ex/neg_ex_4D_float.mod.py new file mode 100644 index 000000000..4d1b10d08 --- /dev/null +++ b/tests/nnapi/specs/Ex/neg_ex_4D_float.mod.py @@ -0,0 +1,25 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{2,3,2,2}") +i2 = Output("op2", "TENSOR_FLOAT32", "{2,3,2,2}") +model = model.Operation("NEG_EX", i1).To(i2) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [3.123456789123456789, 4.123456789123456789, 5.123456789123456789, 6.123456789123456789, + 7.123456789123456789, 8.123456789123456789, 9.123456789123456789, 1.123456789123456789, + 2.123456789123456789, 18.123456789123456789, 19.123456789123456789, 11.123456789123456789, + 40.123456789123456789, 42.123456789123456789, 4.123456789123456789, 12.123456789123456789, + 22.123456789123456789, 32.123456789123456789, 62.123456789123456789, 52.123456789123456789, + 92.123456789123456789, 59.123456789123456789, 69.123456789123456789, 312.123456789123456789]} + +output0 = {i2: # output 0 + [-3.123456789123456789, -4.123456789123456789, -5.123456789123456789, -6.123456789123456789, + -7.123456789123456789, -8.123456789123456789, -9.123456789123456789, -1.123456789123456789, + -2.123456789123456789, -18.123456789123456789, -19.123456789123456789, -11.123456789123456789, + -40.123456789123456789, -42.123456789123456789, -4.123456789123456789, -12.123456789123456789, + -22.123456789123456789, -32.123456789123456789, -62.123456789123456789, -52.123456789123456789, + -92.123456789123456789, -59.123456789123456789, -69.123456789123456789, -312.123456789123456789]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/neg_ex_4D_int.mod.py b/tests/nnapi/specs/Ex/neg_ex_4D_int.mod.py new file mode 100644 index 000000000..ac90eb361 --- /dev/null +++ b/tests/nnapi/specs/Ex/neg_ex_4D_int.mod.py @@ -0,0 +1,25 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_INT32", "{2,3,2,2}") +i2 = Output("op2", "TENSOR_INT32", "{2,3,2,2}") +model = model.Operation("NEG_EX", i1).To(i2) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [3, 4, 5, 6, + -7, 8,-9, 1, + 2, 18, 19, 11, + -40, 42, 4, 12, + 22, -32, 62, 52, + 92, 59, 69, -312]} + +output0 = {i2: # output 0 + [-3, -4, -5, -6, + 7, -8, 9, -1, + -2, -18, -19, -11, + 40, -42, -4, -12, + -22, 32, -62, -52, + -92, -59, -69, 312]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/notequal_ex_broadcast_4D_2D_float.mod.py b/tests/nnapi/specs/Ex/notequal_ex_broadcast_4D_2D_float.mod.py new file mode 100644 index 000000000..ac900511c --- /dev/null +++ b/tests/nnapi/specs/Ex/notequal_ex_broadcast_4D_2D_float.mod.py @@ -0,0 +1,30 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{3, 2, 2, 2}") +i2 = Input("op2", "TENSOR_FLOAT32", "{2, 2}") + +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{3, 2, 2, 2}, 1.f, 0") +model = model.Operation("NOT_EQUAL_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [4.25, 11.0, 2.2, 10.3, + 8.5, 2.1, 1.0, 0.5, + 3.1, 1.0, 8.5, 6.5, + 11.2, 3.0, 8.5, 1.0, + 0.3, 3.0, 2.1, 7.5, + 4.3, 9.2, 11.1, 3.0], + i2: # input 1 + [8.5, 3.0, 2.1, 10.3]} + +output0 = {i3: # output 0 + [255, 255, 255, 0, + 0, 255, 255, 255, + 255, 255, 255, 255, + 255, 0, 255, 255, + 255, 0, 0, 255, + 255, 255, 255, 255] + } + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/notequal_ex_broadcast_float.mod.py b/tests/nnapi/specs/Ex/notequal_ex_broadcast_float.mod.py new file mode 100644 index 000000000..69acc6dea --- /dev/null +++ b/tests/nnapi/specs/Ex/notequal_ex_broadcast_float.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{2, 2}") +i2 = Input("op2", "TENSOR_FLOAT32", "{1, 2}") + +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{2, 2}, 1.f, 0") +model = model.Operation("NOT_EQUAL_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [0.2, 3.21, 2.4, 7.44], + i2: # input 1 + [0.21, 7.44]} + +output0 = {i3: # output 0 + [255, 255, 255, 0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/notequal_ex_float.mod.py b/tests/nnapi/specs/Ex/notequal_ex_float.mod.py new file mode 100644 index 000000000..b3deef7a6 --- /dev/null +++ b/tests/nnapi/specs/Ex/notequal_ex_float.mod.py @@ -0,0 +1,18 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{3}") # a vector of input +i2 = Input("op2", "TENSOR_FLOAT32", "{3}") # a vector of input +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{3}, 1.f, 0") # a vector of output +model = model.Operation("NOT_EQUAL_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [2.0, 3.254232, 5.1232], + i2: # input 1 + [2.0, 3.254111, 5.1232]} + +output0 = {i3: # output 0 + [0, 255, 0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/notequal_ex_quant8.mod.py b/tests/nnapi/specs/Ex/notequal_ex_quant8.mod.py new file mode 100644 index 000000000..d5115a611 --- /dev/null +++ b/tests/nnapi/specs/Ex/notequal_ex_quant8.mod.py @@ -0,0 +1,18 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{3}, 1.f, 0") # a vector of input +i2 = Input("op2", "TENSOR_QUANT8_ASYMM", "{3}, 1.f, 0") # a vector of input +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{3}, 1.f, 0") # a vector of output +model = model.Operation("NOT_EQUAL_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [2, 3, 0], + i2: # input 1 + [2, 9, 0]} + +output0 = {i3: # output 0 + [0, 255, 0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/pack_ex_3D_float_1.mod.py b/tests/nnapi/specs/Ex/pack_ex_3D_float_1.mod.py new file mode 100644 index 000000000..3f3ea683f --- /dev/null +++ b/tests/nnapi/specs/Ex/pack_ex_3D_float_1.mod.py @@ -0,0 +1,54 @@ +# Sample Stack or Pack model +model = Model() +i1 = Input("input1", "TENSOR_FLOAT32", "{2, 3, 4}") +i2 = Input("input2", "TENSOR_FLOAT32", "{2, 3, 4}") +i3 = Input("input3", "TENSOR_FLOAT32", "{2, 3, 4}") +num = Int32Scalar("num_tensors", 3) +axis = Int32Scalar("axis", 0) +out = Output("output", "TENSOR_FLOAT32", "{3, 2, 3, 4}") +model = model.Operation("PACK_EX", i1, i2, i3, num, axis).To(out) + +input0 = {i1: # input 0 + [0.3, 1.0, 2.0, 3.0, + 4.0, 5.5, 6.3, 7.2, + 8.22, 9.8, 10.3, 11.0, + 12.22, 13.2, 14.44, 15.32, + 16.55, 17.33, 18.1, 19.0, + 20.32, 21.9, 22.1, 23.22], + i2: # input 1 + [24.22, 25.1, 26.0, 27.12, + 28.32, 29.11, 30.0, 31.98, + 32.99, 33.11, 34.1, 35.123, + 36.21, 37.22, 38.23, 39.76, + 40.1, 41.43, 42.34, 43.1, + 44.123, 45.43, 46.1, 47.1], + i3: # input 2 + [48.0, 49.76, 50.0, 51.1, + 52.22, 53.12, 54.1, 55.5, + 56.5, 57.4, 58.1, 59.23, + 60.2, 61.12, 62.11, 63.34, + 64.11, 65.1, 66.43, 67.1, + 68.1, 69.34, 70.11, 71.45]} + +output0 = {out: # output 0 + [0.3, 1.0, 2.0, 3.0, + 4.0, 5.5, 6.3, 7.2, + 8.22, 9.8, 10.3, 11.0, + 12.22, 13.2, 14.44, 15.32, + 16.55, 17.33, 18.1, 19.0, + 20.32, 21.9, 22.1, 23.22, + 24.22, 25.1, 26.0, 27.12, + 28.32, 29.11, 30.0, 31.98, + 32.99, 33.11, 34.1, 35.123, + 36.21, 37.22, 38.23, 39.76, + 40.1, 41.43, 42.34, 43.1, + 44.123, 45.43, 46.1, 47.1, + 48.0, 49.76, 50.0, 51.1, + 52.22, 53.12, 54.1, 55.5, + 56.5, 57.4, 58.1, 59.23, + 60.2, 61.12, 62.11, 63.34, + 64.11, 65.1, 66.43, 67.1, + 68.1, 69.34, 70.11, 71.45]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/pack_ex_3D_float_2.mod.py b/tests/nnapi/specs/Ex/pack_ex_3D_float_2.mod.py new file mode 100644 index 000000000..d0caa02cc --- /dev/null +++ b/tests/nnapi/specs/Ex/pack_ex_3D_float_2.mod.py @@ -0,0 +1,54 @@ +# Sample Stack or Pack model +model = Model() +i1 = Input("input1", "TENSOR_FLOAT32", "{2, 3, 4}") +i2 = Input("input2", "TENSOR_FLOAT32", "{2, 3, 4}") +i3 = Input("input3", "TENSOR_FLOAT32", "{2, 3, 4}") +num = Int32Scalar("num_tensors", 3) +axis = Int32Scalar("axis", 2) +out = Output("output", "TENSOR_FLOAT32", "{2, 3, 3, 4}") +model = model.Operation("PACK_EX", i1, i2, i3, num, axis).To(out) + +input0 = {i1: # input 0 + [0.3, 1.0, 2.0, 3.0, + 4.0, 5.5, 6.3, 7.2, + 8.22, 9.8, 10.3, 11.0, + 12.22, 13.2, 14.44, 15.32, + 16.55, 17.33, 18.1, 19.0, + 20.32, 21.9, 22.1, 23.22], + i2: # input 1 + [24.22, 25.1, 26.0, 27.12, + 28.32, 29.11, 30.0, 31.98, + 32.99, 33.11, 34.1, 35.123, + 36.21, 37.22, 38.23, 39.76, + 40.1, 41.43, 42.34, 43.1, + 44.123, 45.43, 46.1, 47.1], + i3: # input 2 + [48.0, 49.76, 50.0, 51.1, + 52.22, 53.12, 54.1, 55.5, + 56.5, 57.4, 58.1, 59.23, + 60.2, 61.12, 62.11, 63.34, + 64.11, 65.1, 66.43, 67.1, + 68.1, 69.34, 70.11, 71.45]} + +output0 = {out: # output 0 + [0.3, 1.0, 2.0, 3.0, + 24.22, 25.1, 26.0, 27.12, + 48.0, 49.76, 50.0, 51.1, + 4.0, 5.5, 6.3, 7.2, + 28.32, 29.11, 30.0, 31.98, + 52.22, 53.12, 54.1, 55.5, + 8.22, 9.8, 10.3, 11.0, + 32.99, 33.11, 34.1, 35.123, + 56.5, 57.4, 58.1, 59.23, + 12.22, 13.2, 14.44, 15.32, + 36.21, 37.22, 38.23, 39.76, + 60.2, 61.12, 62.11, 63.34, + 16.55, 17.33, 18.1, 19.0, + 40.1, 41.43, 42.34, 43.1, + 64.11, 65.1, 66.43, 67.1, + 20.32, 21.9, 22.1, 23.22, + 44.123, 45.43, 46.1, 47.1, + 68.1, 69.34, 70.11, 71.45]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/pack_ex_3D_int_1.mod.py b/tests/nnapi/specs/Ex/pack_ex_3D_int_1.mod.py new file mode 100644 index 000000000..23b365957 --- /dev/null +++ b/tests/nnapi/specs/Ex/pack_ex_3D_int_1.mod.py @@ -0,0 +1,25 @@ +# Sample Stack or Pack model +model = Model() +i1 = Input("input1", "TENSOR_INT32", "{2, 3, 4}") +i2 = Input("input2", "TENSOR_INT32", "{2, 3, 4}") +i3 = Input("input3", "TENSOR_INT32", "{2, 3, 4}") +num = Int32Scalar("num_tensors", 3) +axis = Int32Scalar("axis", 0) +out = Output("output", "TENSOR_INT32", "{3, 2, 3, 4}") +model = model.Operation("PACK_EX", i1, i2, i3, num, axis).To(out) + +input0 = {i1: # input 0 + [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23], + i2: # input 1 + [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47], + i3: # input 2 + [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71]} + +output0 = {out: # output 0 + [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/pack_ex_3D_int_2.mod.py b/tests/nnapi/specs/Ex/pack_ex_3D_int_2.mod.py new file mode 100644 index 000000000..747fcc628 --- /dev/null +++ b/tests/nnapi/specs/Ex/pack_ex_3D_int_2.mod.py @@ -0,0 +1,25 @@ +# Sample Stack or Pack model +model = Model() +i1 = Input("input1", "TENSOR_INT32", "{2, 3, 4}") +i2 = Input("input2", "TENSOR_INT32", "{2, 3, 4}") +i3 = Input("input3", "TENSOR_INT32", "{2, 3, 4}") +num = Int32Scalar("num_tensors", 3) +axis = Int32Scalar("axis", 2) +out = Output("output", "TENSOR_INT32", "{2, 3, 3, 4}") +model = model.Operation("PACK_EX", i1, i2, i3, num, axis).To(out) + +input0 = {i1: # input 0 + [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23], + i2: # input 1 + [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47], + i3: # input 2 + [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71]} + +output0 = {out: # output 0 + [ 0, 1, 2, 3, 24, 25, 26, 27, 48, 49, 50, 51, 4, 5, 6, 7, 28, 29, + 30, 31, 52, 53, 54, 55, 8, 9, 10, 11, 32, 33, 34, 35, 56, 57, 58, 59, + 12, 13, 14, 15, 36, 37, 38, 39, 60, 61, 62, 63, 16, 17, 18, 19, 40, 41, + 42, 43, 64, 65, 66, 67, 20, 21, 22, 23, 44, 45, 46, 47, 68, 69, 70, 71]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/prelu_ex_float_1.mod.py b/tests/nnapi/specs/Ex/prelu_ex_float_1.mod.py new file mode 100644 index 000000000..d2ebd2a0b --- /dev/null +++ b/tests/nnapi/specs/Ex/prelu_ex_float_1.mod.py @@ -0,0 +1,22 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{1, 2, 2, 1}") # a vector of input +i2 = Input("op2", "TENSOR_FLOAT32", "{1, 2, 2, 1}") # a vector of alpha +i3 = Output("op3", "TENSOR_FLOAT32", "{1, 2, 2, 1}") # a vector of output +model = model.Operation("PRELU_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [3.0, -2.0, + -1.0, -2.0 + ], + i2: # input 1 + [0.0, 1.0, + 1.0, 2.0]} + +output0 = {i3: # output 0 + [3.0, -2.0, + -1.0, -4.0 + ]} +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/prelu_ex_float_2.mod.py b/tests/nnapi/specs/Ex/prelu_ex_float_2.mod.py new file mode 100644 index 000000000..d2ebd2a0b --- /dev/null +++ b/tests/nnapi/specs/Ex/prelu_ex_float_2.mod.py @@ -0,0 +1,22 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{1, 2, 2, 1}") # a vector of input +i2 = Input("op2", "TENSOR_FLOAT32", "{1, 2, 2, 1}") # a vector of alpha +i3 = Output("op3", "TENSOR_FLOAT32", "{1, 2, 2, 1}") # a vector of output +model = model.Operation("PRELU_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [3.0, -2.0, + -1.0, -2.0 + ], + i2: # input 1 + [0.0, 1.0, + 1.0, 2.0]} + +output0 = {i3: # output 0 + [3.0, -2.0, + -1.0, -4.0 + ]} +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/reduce_min_ex_float.mod.py b/tests/nnapi/specs/Ex/reduce_min_ex_float.mod.py new file mode 100644 index 000000000..a58c2dba5 --- /dev/null +++ b/tests/nnapi/specs/Ex/reduce_min_ex_float.mod.py @@ -0,0 +1,18 @@ +model = Model() +i1 = Input("input", "TENSOR_FLOAT32", "{1, 2, 2, 1}") +axis = Parameter("axis", "TENSOR_INT32", "{1}", [2]) +output = Output("output", "TENSOR_FLOAT32", "{1, 2, 1}") + +model = model.Operation("REDUCE_MIN_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [2.0, 1.0, + 3.0, 4.0]} + +output0 = {output: # output 0 + [1.0, + 3.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/reduce_min_ex_float_1.mod.py b/tests/nnapi/specs/Ex/reduce_min_ex_float_1.mod.py new file mode 100644 index 000000000..50b23bb8a --- /dev/null +++ b/tests/nnapi/specs/Ex/reduce_min_ex_float_1.mod.py @@ -0,0 +1,17 @@ +model = Model() +i1 = Input("input", "TENSOR_FLOAT32", "{4, 3, 2}") +axis = Parameter("axis", "TENSOR_INT32", "{4}", [1, 0, -3, -3]) +output = Output("output", "TENSOR_FLOAT32", "{2}") + +model = model.Operation("REDUCE_MIN_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [23.0, 24.0, 13.0, 22.0, 5.0, 18.0, 7.0, 8.0, 9.0, 15.0, 11.0, 12.0, + 3.0, 14.0, 10.0, 16.0, 17.0, 6.0, 19.0, 20.0, 21.0, 4.0, 1.0, 2.0]} + +output0 = {output: # output 0 + [1.0, 2.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/reduce_min_ex_float_2.mod.py b/tests/nnapi/specs/Ex/reduce_min_ex_float_2.mod.py new file mode 100644 index 000000000..087ce63b0 --- /dev/null +++ b/tests/nnapi/specs/Ex/reduce_min_ex_float_2.mod.py @@ -0,0 +1,17 @@ +model = Model() +i1 = Input("input", "TENSOR_FLOAT32", "{4, 3, 2}") +axis = Parameter("axis", "TENSOR_INT32", "{2}", [0, 2]) +output = Output("output", "TENSOR_FLOAT32", "{1, 3, 1}") + +model = model.Operation("REDUCE_MIN_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [20.0, 2.0, 22.0, 4.0, 24.0, 18.0, 7.0, 8.0, 19.0, 10.0, 14.0, 12.0, + 13.0, 11.0, 15.0, 16.0, 17.0, 6.0, 9.0, 1.0, 21.0, 3.0, 23.0, 5.0]} + +output0 = {output: # output 0 + [1.0, 3.0, 5.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/reduce_sum_ex_2D_float.mod.py b/tests/nnapi/specs/Ex/reduce_sum_ex_2D_float.mod.py new file mode 100644 index 000000000..1368f66c5 --- /dev/null +++ b/tests/nnapi/specs/Ex/reduce_sum_ex_2D_float.mod.py @@ -0,0 +1,18 @@ +# model +model = Model() +i1 = Input("input", "TENSOR_FLOAT32", "{3, 4}") +axis = Int32Scalar("axis", 1) +out1 = Output("output", "TENSOR_FLOAT32", "{3}") +model = model.Operation("REDUCE_SUM_EX", i1, axis).To(out1) + +# Example 1. Input in operand 0, 1 +input0 = {i1: # input 0 + [3.2, 11.47, 3.8, 5.76, + 28.2, 0.999, -1.3, -13.5, + -3.4, -22.1, -2.2, -49.7]} + +output0 = {out1: # output 0 + [24.23, 14.399002, -77.4]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/reduce_sum_ex_4D_float.mod.py b/tests/nnapi/specs/Ex/reduce_sum_ex_4D_float.mod.py new file mode 100644 index 000000000..15b8dd7b2 --- /dev/null +++ b/tests/nnapi/specs/Ex/reduce_sum_ex_4D_float.mod.py @@ -0,0 +1,18 @@ +# model +model = Model() +i1 = Input("input", "TENSOR_FLOAT32", "{1, 3, 4, 1}") +axis = Int32Scalar("axis", 1) +out1 = Output("output", "TENSOR_FLOAT32", "{1, 4, 1}") +model = model.Operation("REDUCE_SUM_EX", i1, axis).To(out1) + +# Example 1. Input in operand 0, 1 +input0 = {i1: # input 0 + [6.4, 7.3, 19.3, -2.3, + 8.3, 2.0, 11.8, -3.4, + 22.8, 3.0, -28.7, 4.9]} + +output0 = {out1: # output 0 + [37.5, 12.3, 2.3999977, -0.7999997]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/reduce_sum_ex_4D_float_reducing_C.mod.py b/tests/nnapi/specs/Ex/reduce_sum_ex_4D_float_reducing_C.mod.py new file mode 100644 index 000000000..4bfea0f97 --- /dev/null +++ b/tests/nnapi/specs/Ex/reduce_sum_ex_4D_float_reducing_C.mod.py @@ -0,0 +1,32 @@ +batch = 2 +rows = 3 +cols = 4 +depth = 5 + +input_table = [x for x in range(batch * rows * cols * depth)] + +output_table = [0 for x in range(batch * rows * cols)] +for i in range(batch): + for j in range(rows): + for k in range(cols): + for l in range(depth): + # The value of output_table is the depthwise sum of input_table. + output_table[i * rows * cols + j * cols + k] += input_table[i * rows * cols * depth + j * cols * depth + k * depth + l]; + +model = Model() +i1 = Input("input", "TENSOR_FLOAT32", "{%d, %d, %d, %d}" % (batch, rows, cols, depth)) +# Axis value should be in the range [-(rank), rank). And '-n' is the same axis with 'rank - n'. So '3' and '-1' are the same axis. +axis = Parameter("axis", "TENSOR_INT32", "{2}", [3, -1]) +output = Output("output", "TENSOR_FLOAT32", "{%d, %d, %d}" % (batch, rows, cols)) + +model = model.Operation("REDUCE_SUM_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + input_table} + +output0 = {output: # output 0 + output_table} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/reduce_sum_ex_4D_float_reducing_HW.mod.py b/tests/nnapi/specs/Ex/reduce_sum_ex_4D_float_reducing_HW.mod.py new file mode 100644 index 000000000..d94bcf79c --- /dev/null +++ b/tests/nnapi/specs/Ex/reduce_sum_ex_4D_float_reducing_HW.mod.py @@ -0,0 +1,32 @@ +batch = 2 +rows = 3 +cols = 4 +depth = 5 + +input_table = [x for x in range(batch * rows * cols * depth)] + +output_table = [0 for x in range(batch * depth)] +for i in range(batch): + for j in range(rows): + for k in range(cols): + for l in range(depth): + # The value of output_table is the rowwise sum and colwise sum of input_table. + output_table[i * depth + l] += input_table[i * rows * cols * depth + j * cols * depth + k * depth + l]; + +model = Model() +i1 = Input("input", "TENSOR_FLOAT32", "{%d, %d, %d, %d}" % (batch, rows, cols, depth)) +# Axis value should be in the range [-(rank), rank). And '-n' is the same axis with 'rank - n'. So this test's axis value are the same [1, 2]. +axis = Parameter("axis", "TENSOR_INT32", "{4}", [1, 2, -3, -2]) +output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (batch, depth)) + +model = model.Operation("REDUCE_SUM_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + input_table} + +output0 = {output: # output 0 + output_table} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/rsqrt_ex_1D_float.mod.py b/tests/nnapi/specs/Ex/rsqrt_ex_1D_float.mod.py new file mode 100644 index 000000000..f052708cf --- /dev/null +++ b/tests/nnapi/specs/Ex/rsqrt_ex_1D_float.mod.py @@ -0,0 +1,13 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{4}") #A vector of inputs +i2 = Output("op2", "TENSOR_FLOAT32", "{4}") #A vector of outputs +model = model.Operation("RSQRT_EX", i1).To(i2) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [36.0, 90.0, 43.0, 36.0]} +output0 = {i2: # output 0 + [0.166667, 0.105409, 0.152499, 0.166667]} +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/rsqrt_ex_2D_float.mod.py b/tests/nnapi/specs/Ex/rsqrt_ex_2D_float.mod.py new file mode 100644 index 000000000..5f475ae58 --- /dev/null +++ b/tests/nnapi/specs/Ex/rsqrt_ex_2D_float.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() + +i1 = Input("op1", "TENSOR_FLOAT32", "{2, 2}") +i3 = Output("op3", "TENSOR_FLOAT32", "{2, 2}") +model = model.Operation("RSQRT_EX", i1).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1.0, 2.0, 4.0, 8.0]} + +output0 = {i3: # output 0 + [1.0, + 0.70710678118, + 0.5, + 0.35355339059]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/rsqrt_ex_3D_float.mod.py b/tests/nnapi/specs/Ex/rsqrt_ex_3D_float.mod.py new file mode 100644 index 000000000..48abf8c18 --- /dev/null +++ b/tests/nnapi/specs/Ex/rsqrt_ex_3D_float.mod.py @@ -0,0 +1,16 @@ +# model +model = Model() + +i1 = Input("op1", "TENSOR_FLOAT32", "{2, 2, 2}") +i3 = Output("op3", "TENSOR_FLOAT32", "{2, 2, 2}") +model = model.Operation("RSQRT_EX", i1).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1.0, 36.0, 2.0, 90, 4.0, 43.0, 8.0, 36.0]} + +output0 = {i3: # output 0 + [1.0, 0.166667, 0.70710678118, 0.105409, 0.5, 0.152499, 0.35355339059, 0.166667]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/rsqrt_ex_4D_float.mod.py b/tests/nnapi/specs/Ex/rsqrt_ex_4D_float.mod.py new file mode 100644 index 000000000..6a1ae3c00 --- /dev/null +++ b/tests/nnapi/specs/Ex/rsqrt_ex_4D_float.mod.py @@ -0,0 +1,18 @@ +# model +model = Model() + +i1 = Input("op1", "TENSOR_FLOAT32", "{2, 2, 2, 2}") +i3 = Output("op3", "TENSOR_FLOAT32", "{2, 2, 2, 2}") +model = model.Operation("RSQRT_EX", i1).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1.0, 36.0, 2.0, 90, 4.0, 16.0, 25.0, 100.0, + 23.0, 19.0, 40.0, 256.0, 4.0, 43.0, 8.0, 36.0]} + +output0 = {i3: # output 0 + [1.0, 0.166667, 0.70710678118, 0.105409, 0.5, 0.25, 0.2, 0.1, + 0.208514, 0.229416, 0.158114, 0.0625, 0.5, 0.152499, 0.35355339059, 0.166667]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/split_ex_1D_float.mod.py b/tests/nnapi/specs/Ex/split_ex_1D_float.mod.py new file mode 100644 index 000000000..97b61462e --- /dev/null +++ b/tests/nnapi/specs/Ex/split_ex_1D_float.mod.py @@ -0,0 +1,39 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{8}") +axis = Int32Scalar("axis", 0) +i2 = Output("op2", "TENSOR_FLOAT32", "{1}") +i3 = Output("op3", "TENSOR_FLOAT32", "{1}") +i4 = Output("op4", "TENSOR_FLOAT32", "{1}") +i5 = Output("op5", "TENSOR_FLOAT32", "{1}") +i6 = Output("op6", "TENSOR_FLOAT32", "{1}") +i7 = Output("op7", "TENSOR_FLOAT32", "{1}") +i8 = Output("op8", "TENSOR_FLOAT32", "{1}") +i9 = Output("op9", "TENSOR_FLOAT32", "{1}") + +model = model.Operation("SPLIT_EX", axis, i1).To([i2, i3, i4, i5, i6, i7, i8, i9]) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]} + +output0 = { + i2: # output 0 + [1.0], + i3: # output 1 + [2.0], + i4: # output 2 + [3.0], + i5: # output 3 + [4.0], + i6: # output 4 + [5.0], + i7: # output 5 + [6.0], + i8: # output 6 + [7.0], + i9: # output 7 + [8.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/split_ex_1D_int32.mod.py b/tests/nnapi/specs/Ex/split_ex_1D_int32.mod.py new file mode 100644 index 000000000..378b37707 --- /dev/null +++ b/tests/nnapi/specs/Ex/split_ex_1D_int32.mod.py @@ -0,0 +1,39 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_INT32", "{8}") +axis = Int32Scalar("axis", 0) +i2 = Output("op2", "TENSOR_INT32", "{1}") +i3 = Output("op3", "TENSOR_INT32", "{1}") +i4 = Output("op4", "TENSOR_INT32", "{1}") +i5 = Output("op5", "TENSOR_INT32", "{1}") +i6 = Output("op6", "TENSOR_INT32", "{1}") +i7 = Output("op7", "TENSOR_INT32", "{1}") +i8 = Output("op8", "TENSOR_INT32", "{1}") +i9 = Output("op9", "TENSOR_INT32", "{1}") + +model = model.Operation("SPLIT_EX", axis, i1).To([i2, i3, i4, i5, i6, i7, i8, i9]) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1, 2, 3, 4, 5, 6, 7, 8]} + +output0 = { + i2: # output 0 + [1], + i3: # output 1 + [2], + i4: # output 2 + [3], + i5: # output 3 + [4], + i6: # output 4 + [5], + i7: # output 5 + [6], + i8: # output 6 + [7], + i9: # output 7 + [8]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/split_ex_4D_float_1.mod.py b/tests/nnapi/specs/Ex/split_ex_4D_float_1.mod.py new file mode 100644 index 000000000..3059fae7c --- /dev/null +++ b/tests/nnapi/specs/Ex/split_ex_4D_float_1.mod.py @@ -0,0 +1,20 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{2,2,2,2}") +axis = Int32Scalar("axis", 0) +i2 = Output("op2", "TENSOR_FLOAT32", "{1,2,2,2}") +i3 = Output("op3", "TENSOR_FLOAT32", "{1,2,2,2}") +model = model.Operation("SPLIT_EX", axis, i1).To([i2, i3]) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0]} + +output0 = { + i2: # output 0 + [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0], + i3: # output 1 + [9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/split_ex_4D_float_2.mod.py b/tests/nnapi/specs/Ex/split_ex_4D_float_2.mod.py new file mode 100644 index 000000000..faa59bc3c --- /dev/null +++ b/tests/nnapi/specs/Ex/split_ex_4D_float_2.mod.py @@ -0,0 +1,20 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{2,2,2,2}") +axis = Int32Scalar("axis", 3) +i2 = Output("op2", "TENSOR_FLOAT32", "{2,2,2,1}") +i3 = Output("op3", "TENSOR_FLOAT32", "{2,2,2,1}") +model = model.Operation("SPLIT_EX", axis, i1).To([i2, i3]) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0]} + +output0 = { + i2: # output 0 + [1.0, 3.0, 5.0, 7.0, 9.0, 11.0, 13.0, 15.0], + i3: # output 1 + [2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0, 16.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/split_ex_4D_float_3.mod.py b/tests/nnapi/specs/Ex/split_ex_4D_float_3.mod.py new file mode 100644 index 000000000..2091e4b4a --- /dev/null +++ b/tests/nnapi/specs/Ex/split_ex_4D_float_3.mod.py @@ -0,0 +1,20 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{2,2,2,2}") +axis = Int32Scalar("axis", -4) # Negative axis +i2 = Output("op2", "TENSOR_FLOAT32", "{1,2,2,2}") +i3 = Output("op3", "TENSOR_FLOAT32", "{1,2,2,2}") +model = model.Operation("SPLIT_EX", axis, i1).To([i2, i3]) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0]} + +output0 = { + i2: # output 0 + [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0], + i3: # output 1 + [9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/split_ex_4D_int32_1.mod.py b/tests/nnapi/specs/Ex/split_ex_4D_int32_1.mod.py new file mode 100644 index 000000000..3e9438f50 --- /dev/null +++ b/tests/nnapi/specs/Ex/split_ex_4D_int32_1.mod.py @@ -0,0 +1,20 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_INT32", "{2,2,2,2}") +axis = Int32Scalar("axis", 0) +i2 = Output("op2", "TENSOR_INT32", "{1,2,2,2}") +i3 = Output("op3", "TENSOR_INT32", "{1,2,2,2}") +model = model.Operation("SPLIT_EX", axis, i1).To([i2, i3]) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]} + +output0 = { + i2: # output 0 + [1, 2, 3, 4, 5, 6, 7, 8], + i3: # output 1 + [9, 10, 11, 12, 13, 14, 15, 16]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/split_ex_4D_int32_2.mod.py b/tests/nnapi/specs/Ex/split_ex_4D_int32_2.mod.py new file mode 100644 index 000000000..83253cb14 --- /dev/null +++ b/tests/nnapi/specs/Ex/split_ex_4D_int32_2.mod.py @@ -0,0 +1,20 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_INT32", "{2,2,2,2}") +axis = Int32Scalar("axis", 1) +i2 = Output("op2", "TENSOR_INT32", "{2,1,2,2}") +i3 = Output("op3", "TENSOR_INT32", "{2,1,2,2}") +model = model.Operation("SPLIT_EX", axis, i1).To([i2, i3]) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]} + +output0 = { + i2: # output 0 + [1, 2, 3, 4, 9, 10, 11, 12], + i3: # output 1 + [5, 6, 7, 8, 13, 14, 15, 16]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/split_ex_4D_int32_3.mod.py b/tests/nnapi/specs/Ex/split_ex_4D_int32_3.mod.py new file mode 100644 index 000000000..b20b2053b --- /dev/null +++ b/tests/nnapi/specs/Ex/split_ex_4D_int32_3.mod.py @@ -0,0 +1,20 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_INT32", "{2,2,2,2}") +axis = Int32Scalar("axis", 2) +i2 = Output("op2", "TENSOR_INT32", "{2,2,1,2}") +i3 = Output("op3", "TENSOR_INT32", "{2,2,1,2}") +model = model.Operation("SPLIT_EX", axis, i1).To([i2, i3]) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]} + +output0 = { + i2: # output 0 + [1, 2, 5, 6, 9, 10, 13, 14], + i3: # output 1 + [3, 4, 7, 8, 11, 12, 15, 16]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/split_ex_4D_int32_4.mod.py b/tests/nnapi/specs/Ex/split_ex_4D_int32_4.mod.py new file mode 100644 index 000000000..3c255cc48 --- /dev/null +++ b/tests/nnapi/specs/Ex/split_ex_4D_int32_4.mod.py @@ -0,0 +1,20 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_INT32", "{2,2,2,2}") +axis = Int32Scalar("axis", 3) +i2 = Output("op2", "TENSOR_INT32", "{2,2,2,1}") +i3 = Output("op3", "TENSOR_INT32", "{2,2,2,1}") +model = model.Operation("SPLIT_EX", axis, i1).To([i2, i3]) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]} + +output0 = { + i2: # output 0 + [1, 3, 5, 7, 9, 11, 13, 15], + i3: # output 1 + [2, 4, 6, 8, 10, 12, 14, 16]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/split_ex_4D_int32_5.mod.py b/tests/nnapi/specs/Ex/split_ex_4D_int32_5.mod.py new file mode 100644 index 000000000..30e5e245d --- /dev/null +++ b/tests/nnapi/specs/Ex/split_ex_4D_int32_5.mod.py @@ -0,0 +1,20 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_INT32", "{2,2,2,2}") +axis = Int32Scalar("axis", -4) # Negative axis +i2 = Output("op2", "TENSOR_INT32", "{1,2,2,2}") +i3 = Output("op3", "TENSOR_INT32", "{1,2,2,2}") +model = model.Operation("SPLIT_EX", axis, i1).To([i2, i3]) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]} + +output0 = { + i2: # output 0 + [1, 2, 3, 4, 5, 6, 7, 8], + i3: # output 1 + [9, 10, 11, 12, 13, 14, 15, 16]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/split_ex_4D_quant8.mod.py b/tests/nnapi/specs/Ex/split_ex_4D_quant8.mod.py new file mode 100644 index 000000000..46cb3ab78 --- /dev/null +++ b/tests/nnapi/specs/Ex/split_ex_4D_quant8.mod.py @@ -0,0 +1,20 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{2,2,2,2}, 0.5f, 1") +axis = Int32Scalar("axis", 0) +i2 = Output("op2", "TENSOR_QUANT8_ASYMM", "{1,2,2,2}, 0.5f, 1") +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{1,2,2,2}, 0.5f, 1") +model = model.Operation("SPLIT_EX", axis, i1).To([i2, i3]) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]} + +output0 = { + i2: # output 0 + [1, 2, 3, 4, 5, 6, 7, 8], + i3: # output 1 + [9, 10, 11, 12, 13, 14, 15, 16]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/sqrt_ex_1D_float.mod.py b/tests/nnapi/specs/Ex/sqrt_ex_1D_float.mod.py new file mode 100644 index 000000000..fa6a01c54 --- /dev/null +++ b/tests/nnapi/specs/Ex/sqrt_ex_1D_float.mod.py @@ -0,0 +1,15 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{4}") # a vector of input +i2 = Output("op2", "TENSOR_FLOAT32", "{4}") # a vector of output +model = model.Operation("SQRT_EX", i1).To(i2) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [62.0, 5.0, 73.0, 34.0]} + +output0 = {i2: # output 0 + [7.87400787, 2.23606798, 8.54400375, 5.83095189]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/sqrt_ex_2D_float.mod.py b/tests/nnapi/specs/Ex/sqrt_ex_2D_float.mod.py new file mode 100644 index 000000000..d5e816fd4 --- /dev/null +++ b/tests/nnapi/specs/Ex/sqrt_ex_2D_float.mod.py @@ -0,0 +1,13 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{2, 2}") +i2 = Output("op2", "TENSOR_FLOAT32", "{2, 2}") +model = model.Operation("SQRT_EX", i1).To(i2) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [36, 2, 9, 12]} +output0 = {i2: # output 0 + [6.0, 1.41421356, 3.0, 3.46410162]} +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/sqrt_ex_3D_float.mod.py b/tests/nnapi/specs/Ex/sqrt_ex_3D_float.mod.py new file mode 100644 index 000000000..d96a89653 --- /dev/null +++ b/tests/nnapi/specs/Ex/sqrt_ex_3D_float.mod.py @@ -0,0 +1,14 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{2, 2, 2}") +i2 = Output("op2", "TENSOR_FLOAT32", "{2, 2, 2}") +model = model.Operation("SQRT_EX", i1).To(i2) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [90, 36, 22, 10, 9, 80, 40, 18]} +output0 = {i2: # output 0 + [9.48683298, 6.0, 4.69041576, 3.16227766, + 3.0, 8.94427191, 6.32455532, 4.24264069]} +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/sqrt_ex_4D_float.mod.py b/tests/nnapi/specs/Ex/sqrt_ex_4D_float.mod.py new file mode 100644 index 000000000..55561ba0f --- /dev/null +++ b/tests/nnapi/specs/Ex/sqrt_ex_4D_float.mod.py @@ -0,0 +1,14 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{2, 2, 2, 2}") +i2 = Output("op2", "TENSOR_FLOAT32", "{2, 2, 2, 2}") +model = model.Operation("SQRT_EX", i1).To(i2) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [36, 90, 43, 36, 2, 22, 19, 10, 9, 80, 40, 90, 15, 56, 18, 12]} +output0 = {i2: # output 0 + [6.0, 9.48683298, 6.55743852, 6.0, 1.41421356, 4.69041576, 4.35889894, 3.16227766, + 3.0, 8.94427191, 6.32455532, 9.48683298, 3.87298335, 7.48331477, 4.24264069, 3.46410162]} +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/squared_difference_ex_1D_float.mod.py b/tests/nnapi/specs/Ex/squared_difference_ex_1D_float.mod.py new file mode 100644 index 000000000..ef7d9f62e --- /dev/null +++ b/tests/nnapi/specs/Ex/squared_difference_ex_1D_float.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{3}") +i2 = Input("op2", "TENSOR_FLOAT32", "{3}") + +i3 = Output("op3", "TENSOR_FLOAT32", "{3}") +model = model.Operation("SQUARED_DIFFERENCE_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [2.0, 10.8, 19.4212], + i2: # input 1 + [2.0, 4.4, 15.9856]} + +output0 = {i3: # output 0 + [0.0, 40.96, 11.80334736]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/squared_difference_ex_2D_float.mod.py b/tests/nnapi/specs/Ex/squared_difference_ex_2D_float.mod.py new file mode 100644 index 000000000..1753f1960 --- /dev/null +++ b/tests/nnapi/specs/Ex/squared_difference_ex_2D_float.mod.py @@ -0,0 +1,22 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{2, 2}") +i2 = Input("op2", "TENSOR_FLOAT32", "{2, 2}") + +i3 = Output("op3", "TENSOR_FLOAT32", "{2, 2}") +model = model.Operation("SQUARED_DIFFERENCE_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [4.0, 7.8, + 3.1432, 28.987456], + i2: # input 1 + [2.0, 3.2, + 1.9856, 8.167952]} + +output0 = {i3: # output 0 + [4.0, 21.16, + 1.34003776, 433.451746806016]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/squared_difference_ex_3D_float.mod.py b/tests/nnapi/specs/Ex/squared_difference_ex_3D_float.mod.py new file mode 100644 index 000000000..f91043636 --- /dev/null +++ b/tests/nnapi/specs/Ex/squared_difference_ex_3D_float.mod.py @@ -0,0 +1,20 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{2, 2, 2}") +i2 = Input("op2", "TENSOR_FLOAT32", "{2, 2, 2}") + +i3 = Output("op3", "TENSOR_FLOAT32", "{2, 2, 2}") +model = model.Operation("SQUARED_DIFFERENCE_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [4.0, 7.8, 3.1432, 28.987456, 2.0, 10.8, 19.4212, 10.0], + i2: # input 1 + [2.0, 3.2, 1.9856, 8.167952, 2.0, 4.4, 15.9856, 6.0]} + +output0 = {i3: # output 0 + [4.0, 21.16, 1.34003776, 433.451746806016, + 0.0, 40.96, 11.80334736, 16.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/squared_difference_ex_4D_float.mod.py b/tests/nnapi/specs/Ex/squared_difference_ex_4D_float.mod.py new file mode 100644 index 000000000..571c6ce99 --- /dev/null +++ b/tests/nnapi/specs/Ex/squared_difference_ex_4D_float.mod.py @@ -0,0 +1,28 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{2, 2, 2, 2}") +i2 = Input("op2", "TENSOR_FLOAT32", "{2, 2, 2, 2}") + +i3 = Output("op3", "TENSOR_FLOAT32", "{2, 2, 2, 2}") +model = model.Operation("SQUARED_DIFFERENCE_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [4.0, 7.8, 3.1432, 28.987456, + 9.0, 6.0, 5.0, 12.0, + 2.0, 10.8, 19.4212, 10.0, + 27.0, 36.0, 64.0, 128.0], + i2: # input 1 + [2.0, 3.2, 1.9856, 8.167952, + 1.0, 2.0, 5.0, 14.0, + 2.0, 4.4, 15.9856, 6.0, + 18.0, 30.0, 61.0, 120.0]} + +output0 = {i3: # output 0 + [4.0, 21.16, 1.34003776, 433.451746806016, + 64.0, 16.0, 0, 4.0, + 0.0, 40.96, 11.80334736, 16.0, + 81.0, 36.0, 9.0, 64.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/squared_difference_ex_broadcast_4D_2D_float.mod.py b/tests/nnapi/specs/Ex/squared_difference_ex_broadcast_4D_2D_float.mod.py new file mode 100644 index 000000000..8404f4fcd --- /dev/null +++ b/tests/nnapi/specs/Ex/squared_difference_ex_broadcast_4D_2D_float.mod.py @@ -0,0 +1,29 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{3, 2, 2, 2}") +i2 = Input("op2", "TENSOR_FLOAT32", "{2, 2}") + +i3 = Output("op3", "TENSOR_FLOAT32", "{3, 2, 2, 2}") +model = model.Operation("SQUARED_DIFFERENCE_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [74.0, 63.0, 103.0, 88.0, + 57.0, 9.0, 68.0, 20.0, + 121.0, 38.0, 54.0, 119.0, + 56.0, 106.0, 98.0, 98.0, + 7.0, 89.0, 108.0, 104.0, + 20.0, 81.0, 4.0, 124.0], + i2: # input 1 + [56.0, 115.0, 115.0, 116.0]} + +output0 = {i3: # output 0 + [324.0, 2704.0, 144.0, 784.0, + 1.0, 11236.0, 2209.0, 9216.0, + 4225.0, 5929.0, 3721.0, 9.0, + 0.0, 81.0, 289.0, 324.0, + 2401.0, 676.0, 49.0, 144.0, + 1296.0, 1156.0, 12321.0, 64.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/squared_difference_ex_broadcast_float.mod.py b/tests/nnapi/specs/Ex/squared_difference_ex_broadcast_float.mod.py new file mode 100644 index 000000000..0926426e6 --- /dev/null +++ b/tests/nnapi/specs/Ex/squared_difference_ex_broadcast_float.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{1, 2, 2, 1}") +i2 = Input("op2", "TENSOR_FLOAT32", "{1, 1, 2, 1}") + +i3 = Output("op3", "TENSOR_FLOAT32", "{1, 2, 2, 1}") +model = model.Operation("SQUARED_DIFFERENCE_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [4.0, 8.0, 10.0, 14.0], + i2: # input 1 + [1.0, 2.0]} + +output0 = {i3: # output 0 + [9.0, 36.0, 81.0, 144.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_2D_float.mod.py b/tests/nnapi/specs/Ex/tensorflowmax_ex_2D_float.mod.py new file mode 100644 index 000000000..6cf8d83e7 --- /dev/null +++ b/tests/nnapi/specs/Ex/tensorflowmax_ex_2D_float.mod.py @@ -0,0 +1,18 @@ +# model +model = Model() +i1 = Input("input", "TENSOR_FLOAT32", "{3, 4}") +axis = Int32Scalar("axis", 1) +out1 = Output("output", "TENSOR_FLOAT32", "{3}") +model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(out1) + +# Example 1. Input in operand 0, 1 +input0 = {i1: # input 0 + [3.2, 11.47, 3.8, 5.76, + 28.2, 0.999, -1.3, -13.5, + -3.4, -22.1, -2.2, -49.7]} + +output0 = {out1: # output 0 + [11.47, 28.2, -2.2]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_2D_int32.mod.py b/tests/nnapi/specs/Ex/tensorflowmax_ex_2D_int32.mod.py new file mode 100644 index 000000000..940dab3c3 --- /dev/null +++ b/tests/nnapi/specs/Ex/tensorflowmax_ex_2D_int32.mod.py @@ -0,0 +1,18 @@ +# model +model = Model() +i1 = Input("input", "TENSOR_INT32", "{3, 4}") +axis = Int32Scalar("axis", 1) +out1 = Output("output", "TENSOR_INT32", "{3}") +model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(out1) + +# Example 1. Input in operand 0, 1 +input0 = {i1: # input 0 + [3, 11, 3, 5, + 28, 0, -1, -13, + -4, -22, -2, -49]} + +output0 = {out1: # output 0 + [11, 28, -2]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_4D_float_reducing_C.mod.py b/tests/nnapi/specs/Ex/tensorflowmax_ex_4D_float_reducing_C.mod.py new file mode 100644 index 000000000..82a5dbb93 --- /dev/null +++ b/tests/nnapi/specs/Ex/tensorflowmax_ex_4D_float_reducing_C.mod.py @@ -0,0 +1,34 @@ +batch = 2 +rows = 3 +cols = 4 +depth = 5 + +input_table = [x for x in range(batch * rows * cols * depth)] +for i in range(batch): + for j in range(rows): + for k in range(cols): + for l in range(depth): + input_table[i * rows * cols * depth + j * cols * depth + k * depth + l] = i * rows * cols * depth + j * cols * depth + k * depth + l; + +output_table = [x for x in range(batch * rows * cols)] +for i in range(batch): + for j in range(rows): + for k in range(cols): + output_table[i * rows * cols + j * cols + k] = i * rows * cols * depth + j * cols * depth + k * depth + depth - 1; + +model = Model() +i1 = Input("input", "TENSOR_FLOAT32", "{%d, %d, %d, %d}" % (batch, rows, cols, depth)) +axis = Parameter("axis", "TENSOR_INT32", "{2}", [3, -1]) +output = Output("output", "TENSOR_FLOAT32", "{%d, %d, %d}" % (batch, rows, cols)) + +model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + input_table} + +output0 = {output: # output 0 + output_table} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_4D_float_reducing_HW.mod.py b/tests/nnapi/specs/Ex/tensorflowmax_ex_4D_float_reducing_HW.mod.py new file mode 100644 index 000000000..a12762055 --- /dev/null +++ b/tests/nnapi/specs/Ex/tensorflowmax_ex_4D_float_reducing_HW.mod.py @@ -0,0 +1,34 @@ +batch = 2 +rows = 3 +cols = 4 +depth = 5 + +input_table = [x for x in range(batch * rows * cols * depth)] +for i in range(batch): + for j in range(rows): + for k in range(cols): + for l in range(depth): + input_table[i * rows * cols * depth + j * cols * depth + k * depth + l] = i * rows * cols * depth + j * cols * depth + k * depth + l; + +# Since the axises to be reduced are {rows, cols} and the value of the input always increases in here, the output's values are i * rows * cols * depth + (rows - 1) * cols * depth + (cols - 1) * depth + l. +output_table = [x for x in range(batch * depth)] +for i in range(batch): + for l in range(depth): + output_table[i * depth + l] = i * rows * cols * depth + (rows - 1) * cols * depth + (cols - 1) * depth + l; + +model = Model() +i1 = Input("input", "TENSOR_FLOAT32", "{%d, %d, %d, %d}" % (batch, rows, cols, depth)) +axis = Parameter("axis", "TENSOR_INT32", "{4}", [1, 2, -3, -2]) +output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (batch, depth)) + +model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + input_table} + +output0 = {output: # output 0 + output_table} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_float.mod.py b/tests/nnapi/specs/Ex/tensorflowmax_ex_float.mod.py new file mode 100644 index 000000000..6de220721 --- /dev/null +++ b/tests/nnapi/specs/Ex/tensorflowmax_ex_float.mod.py @@ -0,0 +1,18 @@ +model = Model() +i1 = Input("input", "TENSOR_FLOAT32", "{1, 2, 2, 1}") +axis = Parameter("axis", "TENSOR_INT32", "{1}", [2]) +output = Output("output", "TENSOR_FLOAT32", "{1, 2, 1}") + +model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1.0, 2.0, + 3.0, 4.0]} + +output0 = {output: # output 0 + [2.0, + 4.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_float_1.mod.py b/tests/nnapi/specs/Ex/tensorflowmax_ex_float_1.mod.py new file mode 100644 index 000000000..42dc9d94b --- /dev/null +++ b/tests/nnapi/specs/Ex/tensorflowmax_ex_float_1.mod.py @@ -0,0 +1,17 @@ +model = Model() +i1 = Input("input", "TENSOR_FLOAT32", "{4, 3, 2}") +axis = Parameter("axis", "TENSOR_INT32", "{4}", [1, 0, -3, -3]) +output = Output("output", "TENSOR_FLOAT32", "{2}") + +model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, + 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0]} + +output0 = {output: # output 0 + [23.0, 24.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_float_2.mod.py b/tests/nnapi/specs/Ex/tensorflowmax_ex_float_2.mod.py new file mode 100644 index 000000000..98c0d9d03 --- /dev/null +++ b/tests/nnapi/specs/Ex/tensorflowmax_ex_float_2.mod.py @@ -0,0 +1,17 @@ +model = Model() +i1 = Input("input", "TENSOR_FLOAT32", "{4, 3, 2}") +axis = Parameter("axis", "TENSOR_INT32", "{2}", [0, 2]) +output = Output("output", "TENSOR_FLOAT32", "{1, 3, 1}") + +model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, + 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0]} + +output0 = {output: # output 0 + [20, 22, 24]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_quant8_1.mod.py b/tests/nnapi/specs/Ex/tensorflowmax_ex_quant8_1.mod.py new file mode 100644 index 000000000..8e85633b3 --- /dev/null +++ b/tests/nnapi/specs/Ex/tensorflowmax_ex_quant8_1.mod.py @@ -0,0 +1,18 @@ +model = Model() +i1 = Input("input", "TENSOR_QUANT8_ASYMM", "{4, 3, 2}, 0.8, 5") +axis = Parameter("axis", "TENSOR_INT32", "{4}", [1, 0, -3, -3]) +output = Output("output", "TENSOR_QUANT8_ASYMM", "{2}, 0.8, 5") + +model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24]} + +output0 = {output: # output 0 + [23, 24]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_quant8_2.mod.py b/tests/nnapi/specs/Ex/tensorflowmax_ex_quant8_2.mod.py new file mode 100644 index 000000000..75138b14a --- /dev/null +++ b/tests/nnapi/specs/Ex/tensorflowmax_ex_quant8_2.mod.py @@ -0,0 +1,18 @@ +model = Model() +i1 = Input("input", "TENSOR_QUANT8_ASYMM", "{4, 3, 2}, 0.8, 5") +axis = Parameter("axis", "TENSOR_INT32", "{2}", [0, 2]) +output = Output("output", "TENSOR_QUANT8_ASYMM", "{1, 3, 1}, 0.8, 5") + +model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24]} + +output0 = {output: # output 0 + [20, 22, 24]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/topk_v2_ex_1D_float.mod.py b/tests/nnapi/specs/Ex/topk_v2_ex_1D_float.mod.py new file mode 100644 index 000000000..1e0ed21d6 --- /dev/null +++ b/tests/nnapi/specs/Ex/topk_v2_ex_1D_float.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{4}") # a vector of input +k = Int32Scalar("k", 2) +i2 = Output("op2", "TENSOR_FLOAT32", "{2}") # values of output +i3 = Output("op3", "TENSOR_INT32", "{2}") # indexes of output +model = model.Operation("TOPK_V2_EX", i1, k).To([i2, i3]) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [5.123456789123456789, 3.123456789123456789, 4.123456789123456789, 6.123456789123456789]} + +output0 = {i2: # output 0 + [6.123456789123456789, 5.123456789123456789], + i3: # output 1 + [3, 0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/topk_v2_ex_1D_int32.mod.py b/tests/nnapi/specs/Ex/topk_v2_ex_1D_int32.mod.py new file mode 100644 index 000000000..d2bd39adf --- /dev/null +++ b/tests/nnapi/specs/Ex/topk_v2_ex_1D_int32.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_INT32", "{4}") # a vector of input +k = Int32Scalar("k", 2) +i2 = Output("op2", "TENSOR_INT32", "{2}") # values of output +i3 = Output("op3", "TENSOR_INT32", "{2}") # indexes of output +model = model.Operation("TOPK_V2_EX", i1, k).To([i2, i3]) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [50000, 40000, 41000, 60000]} + +output0 = {i2: # output 0 + [60000, 50000], + i3: # output 1 + [3, 0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/topk_v2_ex_1D_quant8.mod.py b/tests/nnapi/specs/Ex/topk_v2_ex_1D_quant8.mod.py new file mode 100644 index 000000000..6f36ce41f --- /dev/null +++ b/tests/nnapi/specs/Ex/topk_v2_ex_1D_quant8.mod.py @@ -0,0 +1,19 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{4}, 0.5f, 1") # a vector of input +k = Int32Scalar("k", 2) +i2 = Output("op2", "TENSOR_QUANT8_ASYMM", "{2}, 0.5f, 1") # values of output +i3 = Output("op3", "TENSOR_INT32", "{2}") # indexes of output +model = model.Operation("TOPK_V2_EX", i1, k).To([i2, i3]) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [7, 4, 5, 6]} + +output0 = {i2: # output 0 + [7, 6], + i3: # output 1 + [0, 3]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/topk_v2_ex_2D_float.mod.py b/tests/nnapi/specs/Ex/topk_v2_ex_2D_float.mod.py new file mode 100644 index 000000000..204bc143f --- /dev/null +++ b/tests/nnapi/specs/Ex/topk_v2_ex_2D_float.mod.py @@ -0,0 +1,25 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{3,4}") # a matirx of input +k = Int32Scalar("k", 2) +o1 = Output("op2", "TENSOR_FLOAT32", "{3,2}") # values of output +o2 = Output("op3", "TENSOR_INT32", "{3,2}") # indexes of output +model = model.Operation("TOPK_V2_EX", i1, k).To([o1, o2]) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [3.123456789123456789, 4.123456789123456789, 5.123456789123456789, 6.123456789123456789, + 7.123456789123456789, 8.123456789123456789, 9.123456789123456789, 1.123456789123456789, + 2.123456789123456789, 18.123456789123456789, 19.123456789123456789, 11.123456789123456789]} + +output0 = {o1: # output 1 + [6.123456789123456789, 5.123456789123456789, + 9.123456789123456789, 8.123456789123456789, + 19.123456789123456789, 18.123456789123456789], + o2: # output 1 + [3, 2, + 2, 1, + 2, 1]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/topk_v2_ex_2D_int32.mod.py b/tests/nnapi/specs/Ex/topk_v2_ex_2D_int32.mod.py new file mode 100644 index 000000000..b90a35488 --- /dev/null +++ b/tests/nnapi/specs/Ex/topk_v2_ex_2D_int32.mod.py @@ -0,0 +1,25 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_INT32", "{3,4}") # a vector of input +k = Int32Scalar("k", 2) +i2 = Output("op2", "TENSOR_INT32", "{3,2}") # indexes of output +i3 = Output("op3", "TENSOR_INT32", "{3,2}") # values of output +model = model.Operation("TOPK_V2_EX", i1, k).To([i2, i3]) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [40000, 41000, 50000, 60000, + 70000, 80000, 90000, 79000, + 170000, 180000, 190000, 110000]} + +output0 = {i2: # output 0 + [60000, 50000, + 90000, 80000, + 190000, 180000], + i3: # output 1 + [3, 2, + 2, 1, + 2, 1]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/topk_v2_ex_2D_quant8.mod.py b/tests/nnapi/specs/Ex/topk_v2_ex_2D_quant8.mod.py new file mode 100644 index 000000000..d8b5c6075 --- /dev/null +++ b/tests/nnapi/specs/Ex/topk_v2_ex_2D_quant8.mod.py @@ -0,0 +1,25 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{3,4}, 0.5f, 1") # a vector of input +k = Int32Scalar("k", 2) +i2 = Output("op2", "TENSOR_QUANT8_ASYMM", "{3,2}, 0.5f, 1") # values of output +i3 = Output("op3", "TENSOR_INT32", "{3,2}") # indexes of output +model = model.Operation("TOPK_V2_EX", i1, k).To([i2, i3]) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [3, 4, 5, 6, + 7, 8, 9, 1, + 2, 18, 19, 11]} + +output0 = {i2: # output 0 + [6, 5, + 9, 8, + 19, 18], + i3: # output 1 + [3, 2, + 2, 1, + 2, 1]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/transpose_conv_ex_float_1.mod.py b/tests/nnapi/specs/Ex/transpose_conv_ex_float_1.mod.py new file mode 100644 index 000000000..82b59c3cf --- /dev/null +++ b/tests/nnapi/specs/Ex/transpose_conv_ex_float_1.mod.py @@ -0,0 +1,30 @@ +# model +model = Model() +i0 = Input("op_shape", "TENSOR_INT32", "{4}") +weights = Input("ker", "TENSOR_FLOAT32", "{1, 3, 3, 1}") +i1 = Input("in", "TENSOR_FLOAT32", "{1, 4, 4, 1}" ) +pad = Int32Scalar("pad_same", 1) +s_x = Int32Scalar("stride_x", 1) +s_y = Int32Scalar("stride_y", 1) +i2 = Output("op", "TENSOR_FLOAT32", "{1, 4, 4, 1}") +model = model.Operation("TRANSPOSE_CONV_EX", i0, weights, i1, pad, s_x, s_y).To(i2) + +# Example 1. Input in operand 0, +input0 = {i0: # output shape + [1, 4, 4, 1], + i1: # input 0 + [1.0, 2.0, 3.0, 4.0, + 5.0, 6.0, 7.0, 8.0, + 9.0, 10.0, 11.0, 12.0, + 13.0, 14.0, 15.0, 16.0], + weights: # input 1 + [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]} + +output0 = {i2: # output 0 + [29.0, 62.0, 83.0, 75.0, + 99.0, 192.0, 237.0, 198.0, + 207.0, 372.0, 417.0, 330.0, + 263.0, 446.0, 485.0, 365.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/transpose_conv_ex_float_2.mod.py b/tests/nnapi/specs/Ex/transpose_conv_ex_float_2.mod.py new file mode 100644 index 000000000..e209345c6 --- /dev/null +++ b/tests/nnapi/specs/Ex/transpose_conv_ex_float_2.mod.py @@ -0,0 +1,28 @@ +# model +model = Model() +i0 = Input("op_shape", "TENSOR_INT32", "{4}") +weights = Input("ker", "TENSOR_FLOAT32", "{1, 3, 3, 1}") +i1 = Input("in", "TENSOR_FLOAT32", "{1, 2, 2, 1}" ) +pad = Int32Scalar("pad_valid", 2) +s_x = Int32Scalar("stride_x", 2) +s_y = Int32Scalar("stride_y", 2) +i2 = Output("op", "TENSOR_FLOAT32", "{1, 5, 5, 1}") +model = model.Operation("TRANSPOSE_CONV_EX", i0, weights, i1, pad, s_x, s_y).To(i2) + +# Example 1. Input in operand 0, +input0 = {i0: # output shape + [1, 5, 5, 1], + i1: # input 0 + [1.0, 2.0, 3.0, 4.0], + weights: # input 1 + [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]} + +output0 = {i2: # output 0 + [1.0, 2.0, 5.0, 4.0, 6.0, + 4.0, 5.0, 14.0, 10.0, 12.0, + 10.0, 14.0, 36.0, 24.0, 30.0, + 12.0, 15.0, 34.0, 20.0, 24.0, + 21.0, 24.0, 55.0, 32.0, 36.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/transpose_conv_ex_float_3.mod.py b/tests/nnapi/specs/Ex/transpose_conv_ex_float_3.mod.py new file mode 100644 index 000000000..056c5809d --- /dev/null +++ b/tests/nnapi/specs/Ex/transpose_conv_ex_float_3.mod.py @@ -0,0 +1,35 @@ +# model +model = Model() +i0 = Input("op_shape", "TENSOR_INT32", "{4}") +weights = Input("ker", "TENSOR_FLOAT32", "{2, 3, 3, 1}") +i1 = Input("in", "TENSOR_FLOAT32", "{1, 2, 2, 1}" ) +pad = Int32Scalar("pad_valid", 2) +s_x = Int32Scalar("stride_x", 2) +s_y = Int32Scalar("stride_y", 2) +i2 = Output("op", "TENSOR_FLOAT32", "{1, 5, 5, 2}") +model = model.Operation("TRANSPOSE_CONV_EX", i0, weights, i1, pad, s_x, s_y).To(i2) + +# Example 1. Input in operand 0, +input0 = {i0: # output shape + [1, 5, 5, 2], + i1: # input 0 + [1.0, 2.0, 3.0, 4.0], + weights: # input 1 + [1.0, 3.0, 5.0, 7.0, 9.0, 11.0, + 13.0, 15.0, 17.0, 2.0, 4.0, 6.0, + 8.0, 10.0, 12.0, 14.0, 16.0, 18.0]} + +output0 = {i2: # output 0 + [1.0, 2.0, 3.0, 4.0, 7.0, + 10.0, 6.0, 8.0, 10.0, 12.0, + 7.0, 8.0, 9.0, 10.0, 25.0, + 28.0, 18.0, 20.0, 22.0, 24.0, + 16.0, 20.0, 24.0, 28.0, 62.0, + 72.0, 42.0, 48.0, 54.0, 60.0, + 21.0, 24.0, 27.0, 30.0, 61.0, + 68.0, 36.0, 40.0, 44.0, 48.0, + 39.0, 42.0, 45.0, 48.0, 103.0, + 110.0, 60.0, 64.0, 68.0, 72.0]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/transpose_conv_ex_int_1.mod.py b/tests/nnapi/specs/Ex/transpose_conv_ex_int_1.mod.py new file mode 100644 index 000000000..fb8eb72be --- /dev/null +++ b/tests/nnapi/specs/Ex/transpose_conv_ex_int_1.mod.py @@ -0,0 +1,24 @@ +# model +model = Model() +i0 = Input("op_shape", "TENSOR_INT32", "{4}") +weights = Input("ker", "TENSOR_INT32", "{1, 3, 3, 1}") +i1 = Input("in", "TENSOR_INT32", "{1, 4, 4, 1}" ) +pad = Int32Scalar("pad_same", 1) +s_x = Int32Scalar("stride_x", 1) +s_y = Int32Scalar("stride_y", 1) +i2 = Output("op", "TENSOR_INT32", "{1, 4, 4, 1}") +model = model.Operation("TRANSPOSE_CONV_EX", i0, weights, i1, pad, s_x, s_y).To(i2) + +# Example 1. Input in operand 0, +input0 = {i0: # output shape + [1, 4, 4, 1], + i1: # input 0 + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], + weights: # input 1 + [1, 2, 3, 4, 5, 6, 7, 8, 9]} + +output0 = {i2: # output 0 + [29, 62, 83, 75, 99, 192, 237, 198, 207, 372, 417, 330, 263, 446, 485, 365]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/transpose_conv_ex_int_2.mod.py b/tests/nnapi/specs/Ex/transpose_conv_ex_int_2.mod.py new file mode 100644 index 000000000..9bf4b113d --- /dev/null +++ b/tests/nnapi/specs/Ex/transpose_conv_ex_int_2.mod.py @@ -0,0 +1,25 @@ +# model +model = Model() +i0 = Input("op_shape", "TENSOR_INT32", "{4}") +weights = Input("ker", "TENSOR_INT32", "{1, 3, 3, 1}") +i1 = Input("in", "TENSOR_INT32", "{1, 2, 2, 1}" ) +pad = Int32Scalar("pad_valid", 2) +s_x = Int32Scalar("stride_x", 2) +s_y = Int32Scalar("stride_y", 2) +i2 = Output("op", "TENSOR_INT32", "{1, 5, 5, 1}") +model = model.Operation("TRANSPOSE_CONV_EX", i0, weights, i1, pad, s_x, s_y).To(i2) + +# Example 1. Input in operand 0, +input0 = {i0: # output shape + [1, 5, 5, 1], + i1: # input 0 + [1, 2, 3, 4], + weights: # input 1 + [1, 2, 3, 4, 5, 6, 7, 8, 9]} + +output0 = {i2: # output 0 + [1, 2, 5, 4, 6, 4, 5, 14, 10, 12, 10, 14, 36, + 24, 30, 12, 15, 34, 20, 24, 21, 24, 55, 32, 36]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/transpose_conv_ex_int_3.mod.py b/tests/nnapi/specs/Ex/transpose_conv_ex_int_3.mod.py new file mode 100644 index 000000000..e44480968 --- /dev/null +++ b/tests/nnapi/specs/Ex/transpose_conv_ex_int_3.mod.py @@ -0,0 +1,27 @@ +# model +model = Model() +i0 = Input("op_shape", "TENSOR_INT32", "{4}") +weights = Input("ker", "TENSOR_INT32", "{2, 3, 3, 1}") +i1 = Input("in", "TENSOR_INT32", "{1, 2, 2, 1}" ) +pad = Int32Scalar("pad_valid", 2) +s_x = Int32Scalar("stride_x", 2) +s_y = Int32Scalar("stride_y", 2) +i2 = Output("op", "TENSOR_INT32", "{1, 5, 5, 2}") +model = model.Operation("TRANSPOSE_CONV_EX", i0, weights, i1, pad, s_x, s_y).To(i2) + +# Example 1. Input in operand 0, +input0 = {i0: # output shape + [1, 5, 5, 2], + i1: # input 0 + [1, 2, 3, 4], + weights: # input 1 + [1, 3, 5, 7, 9, 11, 13, 15, 17, 2, 4, 6, 8, 10, 12, 14, 16, 18]} + +output0 = {i2: # output 0 + [1, 2, 3, 4, 7, 10, 6, 8, 10, 12, 7, 8, 9, + 10, 25, 28, 18, 20, 22, 24, 16, 20, 24, 28, 62, 72, + 42, 48, 54, 60, 21, 24, 27, 30, 61, 68, 36, 40, 44, + 48, 39, 42, 45, 48, 103, 110, 60, 64, 68, 72]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/unpack_ex_3D_float_1.mod.py b/tests/nnapi/specs/Ex/unpack_ex_3D_float_1.mod.py new file mode 100644 index 000000000..e5cb38e4b --- /dev/null +++ b/tests/nnapi/specs/Ex/unpack_ex_3D_float_1.mod.py @@ -0,0 +1,53 @@ +# Sample UnPack model, axis = 0 +model = Model() +input = Input("input", "TENSOR_FLOAT32", "{3, 2, 3, 4}") +axis = Int32Scalar("axis", 0) +num_splits = Int32Scalar("num_splits", 3) +out1 = Output("output1", "TENSOR_FLOAT32", "{2, 3, 4}") +out2 = Output("output2", "TENSOR_FLOAT32", "{2, 3, 4}") +out3 = Output("output3", "TENSOR_FLOAT32", "{2, 3, 4}") +model = model.Operation("UNPACK_EX", input, num_splits, axis).To([out1, out2, out3]) + +input0 = {input: # input 0 + [0.0, 1.0, 2.0, 3.0, + 4.0, 5.0, 6.0, 7.0, + 8.0, 9.0, 10.0, 11.0, + 12.0, 13.0, 14.0, 15.0, + 16.0, 17.0, 18.0, 19.0, + 20.0, 21.0, 22.0, 23.0, + 24.0, 25.0, 26.0, 27.0, + 28.0, 29.0, 30.0, 31.0, + 32.0, 33.0, 34.0, 35.0, + 36.0, 37.0, 38.0, 39.0, + 40.0, 41.0, 42.0, 43.0, + 44.0, 45.0, 46.0, 47.0, + 48.0, 49.0, 50.0, 51.0, + 52.0, 53.0, 54.0, 55.0, + 56.0, 57.0, 58.0, 59.0, + 60.0, 61.0, 62.0, 63.0, + 64.0, 65.0, 66.0, 67.0, + 68.0, 69.0, 70.0, 71.0]} + +output0 = {out1: # output 0 + [0.0, 1.0, 2.0, 3.0, + 4.0, 5.0, 6.0, 7.0, + 8.0, 9.0, 10.0, 11.0, + 12.0, 13.0, 14.0, 15.0, + 16.0, 17.0, 18.0, 19.0, + 20.0, 21.0, 22.0, 23.0], + out2: # output 1 + [24.0, 25.0, 26.0, 27.0, + 28.0, 29.0, 30.0, 31.0, + 32.0, 33.0, 34.0, 35.0, + 36.0, 37.0, 38.0, 39.0, + 40.0, 41.0, 42.0, 43.0, + 44.0, 45.0, 46.0, 47.0], + out3: # output 2 + [48.0, 49.0, 50.0, 51.0, + 52.0, 53.0, 54.0, 55.0, + 56.0, 57.0, 58.0, 59.0, + 60.0, 61.0, 62.0, 63.0, + 64.0, 65.0, 66.0, 67.0, + 68.0, 69.0, 70.0, 71.0]} +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/unpack_ex_3D_float_2.mod.py b/tests/nnapi/specs/Ex/unpack_ex_3D_float_2.mod.py new file mode 100644 index 000000000..1d1045ae9 --- /dev/null +++ b/tests/nnapi/specs/Ex/unpack_ex_3D_float_2.mod.py @@ -0,0 +1,54 @@ +# Sample UnPack model, axis = 2 +model = Model() +input = Input("input", "TENSOR_FLOAT32", "{3, 2, 3, 4}") +axis = Int32Scalar("axis", 2) +num_splits = Int32Scalar("num_splits", 3) +out1 = Output("output1", "TENSOR_FLOAT32", "{3, 2, 4}") +out2 = Output("output2", "TENSOR_FLOAT32", "{3, 2, 4}") +out3 = Output("output3", "TENSOR_FLOAT32", "{3, 2, 4}") +model = model.Operation("UNPACK_EX", input, num_splits, axis).To([out1, out2, out3]) + +input0 = {input: # input 0 + [0.3, 1.2, 2.1, 3.454, + 4.12, 5.23, 6.34, 7.12, + 8.2, 9.23, 10.11, 11.34, + 12.3, 13.12, 14.122, 15.1, + 16.11, 17.234, 18.2, 19.1, + 20.45, 21.5, 22.5, 23.64, + 24.2, 25.76, 26.4, 27.34, + 28.43, 29.112, 30.45, 31.5, + 32.45, 33.65, 34.6, 35.34, + 36.3, 37.54, 38.6743, 39.56, + 40.451, 41.56, 42.55, 43.511, + 44.4, 45.45, 46.5641, 47.122, + 48.1, 49.456, 50.56, 51.11, + 52.1, 53.34, 54.62, 55.1, + 56.12, 57.4, 58.2, 59.1, + 60.465, 61.1, 62.3, 63.45, + 64.1, 65.11, 66.4, 67.9, + 68.123, 69.65, 70.89, 71.987]} + +output0 = {out1: # output 0 + [0.3, 1.2, 2.1, 3.454, + 12.3, 13.12, 14.122, 15.1, + 24.2, 25.76, 26.4, 27.34, + 36.3, 37.54, 38.6743, 39.56, + 48.1, 49.456, 50.56, 51.11, + 60.465, 61.1, 62.3, 63.45], + out2: # output 1 + [4.12, 5.23, 6.34, 7.12, + 16.11, 17.234, 18.2, 19.1, + 28.43, 29.112, 30.45, 31.5, + 40.451, 41.56, 42.55, 43.511, + 52.1, 53.34, 54.62, 55.1, + 64.1, 65.11, 66.4, 67.9], + out3: # output 2 + [8.2, 9.23, 10.11, 11.34, + 20.45, 21.5, 22.5, 23.64, + 32.45, 33.65, 34.6, 35.34, + 44.4, 45.45, 46.5641, 47.122, + 56.12, 57.4, 58.2, 59.1, + 68.123, 69.65, 70.89, 71.987]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/unpack_ex_3D_int_1.mod.py b/tests/nnapi/specs/Ex/unpack_ex_3D_int_1.mod.py new file mode 100644 index 000000000..2a668cf7e --- /dev/null +++ b/tests/nnapi/specs/Ex/unpack_ex_3D_int_1.mod.py @@ -0,0 +1,25 @@ +# Sample UnPack model, axis = 0 +model = Model() +input = Input("input", "TENSOR_INT32", "{3, 2, 3, 4}") +axis = Int32Scalar("axis", 0) +num_splits = Int32Scalar("num_splits", 3) +out1 = Output("output1", "TENSOR_INT32", "{2, 3, 4}") +out2 = Output("output2", "TENSOR_INT32", "{2, 3, 4}") +out3 = Output("output3", "TENSOR_INT32", "{2, 3, 4}") +model = model.Operation("UNPACK_EX", input, num_splits, axis).To([out1, out2, out3]) + +input0 = {input: # input 0 + [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71]} + +output0 = {out1: # output 0 + [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23], + out2: # output 1 + [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47], + out3: # output 2 + [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71]} + +# Instantiate an example +Example((input0, output0)) diff --git a/tests/nnapi/specs/Ex/unpack_ex_3D_int_2.mod.py b/tests/nnapi/specs/Ex/unpack_ex_3D_int_2.mod.py new file mode 100644 index 000000000..115954972 --- /dev/null +++ b/tests/nnapi/specs/Ex/unpack_ex_3D_int_2.mod.py @@ -0,0 +1,25 @@ +# Sample UnPack model, axis = 2 +model = Model() +input = Input("input", "TENSOR_INT32", "{3, 2, 3, 4}") +axis = Int32Scalar("axis", 2) +num_splits = Int32Scalar("num_splits", 3) +out1 = Output("output1", "TENSOR_INT32", "{3, 2, 4}") +out2 = Output("output2", "TENSOR_INT32", "{3, 2, 4}") +out3 = Output("output3", "TENSOR_INT32", "{3, 2, 4}") +model = model.Operation("UNPACK_EX", input, num_splits, axis).To([out1, out2, out3]) + +input0 = {input: # input 0 + [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71]} + +output0 = {out1: # output 0 + [0, 1, 2, 3, 12, 13, 14, 15, 24, 25, 26, 27, 36, 37, 38, 39, 48, 49, 50, 51, 60, 61, 62, 63], + out2: # output 1 + [4, 5, 6, 7, 16, 17, 18, 19, 28, 29, 30, 31, 40, 41, 42, 43, 52, 53, 54, 55, 64, 65, 66, 67], + out3: # output 2 + [8, 9,10, 11, 20, 21, 22, 23, 32, 33, 34, 35, 44, 45, 46, 47, 56, 57, 58, 59, 68, 69, 70, 71]} + +# Instantiate an example +Example((input0, output0)) |