cast_ex_int32_to_float32::is_ignored,
cast_ex_int32_to_float32::examples);
}
+
+namespace topk_v2_1D_float {
+std::vector<MixedTypedExample> examples = {
+// Generated topk_v2_1D_float test
+#include "generated/examples/topk_v2_1D_float.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/topk_v2_1D_float.model.cpp"
+} // namespace topk_v2_1D_float
+TEST_F(GeneratedTests, topk_v2_1D_float) {
+ execute(topk_v2_1D_float::CreateModel,
+ topk_v2_1D_float::is_ignored,
+ topk_v2_1D_float::examples);
+}
+
+namespace topk_v2_2D_float {
+std::vector<MixedTypedExample> examples = {
+// Generated topk_v2_2D_float test
+#include "generated/examples/topk_v2_2D_float.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/topk_v2_2D_float.model.cpp"
+} // namespace topk_v2_2D_float
+TEST_F(GeneratedTests, topk_v2_2D_float) {
+ execute(topk_v2_2D_float::CreateModel,
+ topk_v2_2D_float::is_ignored,
+ topk_v2_2D_float::examples);
+}
--- /dev/null
+// Generated file (from: topk_v2_1D_float.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {3.123456789123457f, 4.123456789123456f, 5.123456789123456f, 6.123456789123456f}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{1, {6.123456789123456f, 5.123456789123456f}}},
+ // int -> INT32 map
+ {{0, {3, 2}}},
+ // int -> QUANT8_ASYMM map
+ {}
+}
+}, // End of an example
--- /dev/null
+// Generated file (from: topk_v2_2D_float.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {3.123456789123457f, 4.123456789123456f, 5.123456789123456f, 6.123456789123456f, 7.123456789123456f, 8.123456789123457f, 9.123456789123457f, 1.1234567891234568f, 2.123456789123457f, 18.123456789123455f, 19.123456789123455f, 11.123456789123457f}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{1, {6.123456789123456f, 5.123456789123456f, 9.123456789123457f, 8.123456789123457f, 19.123456789123455f, 18.123456789123455f}}},
+ // int -> INT32 map
+ {{0, {3, 2, 2, 1, 2, 1}}},
+ // int -> QUANT8_ASYMM map
+ {}
+}
+}, // End of an example
--- /dev/null
+// Generated file (from: topk_v2_1D_float.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type1(Type::INT32, {});
+ OperandType type3(Type::TENSOR_FLOAT32, {2});
+ OperandType type0(Type::TENSOR_FLOAT32, {4});
+ OperandType type2(Type::TENSOR_INT32, {2});
+ // Phase 1, operands
+ auto op1 = model->addOperand(&type0);
+ auto k = model->addOperand(&type1);
+ auto op2 = model->addOperand(&type2);
+ auto op3 = model->addOperand(&type3);
+ // Phase 2, operations
+ static int32_t k_init[] = {2};
+ model->setOperandValue(k, k_init, sizeof(int32_t) * 1);
+ model->addOperationEx(ANEURALNETWORKS_TOPK_V2_EX, {op1, k}, {op2, op3});
+ // Phase 3, inputs and outputs
+ model->identifyInputsAndOutputs(
+ {op1},
+ {op2, op3});
+ assert(model->isValid());
+}
+
+bool is_ignored(int i) {
+ static std::set<int> ignore = {};
+ return ignore.find(i) != ignore.end();
+}
--- /dev/null
+// Generated file (from: topk_v2_2D_float.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type1(Type::INT32, {});
+ OperandType type3(Type::TENSOR_FLOAT32, {3,2});
+ OperandType type0(Type::TENSOR_FLOAT32, {3,4});
+ OperandType type2(Type::TENSOR_INT32, {3,2});
+ // Phase 1, operands
+ auto op1 = model->addOperand(&type0);
+ auto k = model->addOperand(&type1);
+ auto op2 = model->addOperand(&type2);
+ auto op3 = model->addOperand(&type3);
+ // Phase 2, operations
+ static int32_t k_init[] = {2};
+ model->setOperandValue(k, k_init, sizeof(int32_t) * 1);
+ model->addOperationEx(ANEURALNETWORKS_TOPK_V2_EX, {op1, k}, {op2, op3});
+ // Phase 3, inputs and outputs
+ model->identifyInputsAndOutputs(
+ {op1},
+ {op2, op3});
+ assert(model->isValid());
+}
+
+bool is_ignored(int i) {
+ static std::set<int> ignore = {};
+ return ignore.find(i) != ignore.end();
+}
--- /dev/null
+# model
+model = Model()
+i1 = Input("op1", "TENSOR_FLOAT32", "{4}") # a vector of input
+k = Int32Scalar("k", 2)
+i2 = Output("op2", "TENSOR_INT32", "{2}") # indexes of output
+i3 = Output("op3", "TENSOR_FLOAT32", "{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
+ [3.123456789123456789, 4.123456789123456789, 5.123456789123456789, 6.123456789123456789]}
+
+output0 = {i2: # output 0
+ [3, 2],
+ i3: # output 1
+ [6.123456789123456789, 5.123456789123456789]}
+
+# Instantiate an example
+Example((input0, output0))
--- /dev/null
+# model
+model = Model()
+i1 = Input("op1", "TENSOR_FLOAT32", "{3,4}") # a matirx of input
+k = Int32Scalar("k", 2)
+o1 = Output("op2", "TENSOR_INT32", "{3,2}") # indexes of output
+o2 = Output("op3", "TENSOR_FLOAT32", "{3,2}") # values 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 0
+ [3, 2,
+ 2, 1,
+ 2, 1],
+ o2: # output 1
+ [6.123456789123456789, 5.123456789123456789,
+ 9.123456789123456789, 8.123456789123456789,
+ 19.123456789123456789, 18.123456789123456789]}
+
+# Instantiate an example
+Example((input0, output0))