This test is consist of an ADD, a CONCATENATION and a RESHAPE operation.
CONCATENATION and RESHAPE are NOP just copy the value to the output.
They are exist for making test easier with different layouts(NCHW/NHWC)
on neurun.
Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
// DO NOT EDIT;
// Generated by nnfw/runtimes/tests/neural_networks_test/specs/generate_test.sh
+namespace add_broadcast_4D_2D_after_nops_float_nnfw {
+std::vector<MixedTypedExample> examples = {
+// Generated add_broadcast_4D_2D_after_nops_float_nnfw test
+#include "generated/examples/add_broadcast_4D_2D_after_nops_float_nnfw.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/add_broadcast_4D_2D_after_nops_float_nnfw.model.cpp"
+} // namespace add_broadcast_4D_2D_after_nops_float_nnfw
+TEST_F(GeneratedTests, add_broadcast_4D_2D_after_nops_float_nnfw) {
+ execute(add_broadcast_4D_2D_after_nops_float_nnfw::CreateModel,
+ add_broadcast_4D_2D_after_nops_float_nnfw::is_ignored,
+ add_broadcast_4D_2D_after_nops_float_nnfw::examples);
+}
+
namespace add_broadcast_quant8 {
std::vector<MixedTypedExample> examples = {
// Generated add_broadcast_quant8 test
--- /dev/null
+// Generated file (from: add_broadcast_4D_2D_after_nops_float_nnfw.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}}, {1, {100, 200}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+}
+}, // End of an example
--- /dev/null
+// Generated file (from: add_broadcast_4D_2D_after_nops_float_nnfw.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type1(Type::INT32, {});
+ OperandType type0(Type::TENSOR_FLOAT32, {1, 1, 3, 4});
+ OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 1, 1});
+ OperandType type4(Type::TENSOR_FLOAT32, {1, 2, 3, 4});
+ OperandType type3(Type::TENSOR_INT32, {4});
+ // Phase 1, operands
+ auto op1 = model->addOperand(&type0);
+ auto axis0 = model->addOperand(&type1);
+ auto op3 = model->addOperand(&type2);
+ auto op4 = model->addOperand(&type3);
+ auto op5 = model->addOperand(&type0);
+ auto op6 = model->addOperand(&type2);
+ auto op7 = model->addOperand(&type4);
+ auto act = model->addOperand(&type1);
+ // Phase 2, operations
+ static int32_t axis0_init[] = {0};
+ model->setOperandValue(axis0, axis0_init, sizeof(int32_t) * 1);
+ static int32_t op4_init[] = {1, 2, 1, 1};
+ model->setOperandValue(op4, op4_init, sizeof(int32_t) * 4);
+ static int32_t act_init[] = {0};
+ model->setOperandValue(act, act_init, sizeof(int32_t) * 1);
+ model->addOperation(ANEURALNETWORKS_CONCATENATION, {op1, axis0}, {op5});
+ model->addOperation(ANEURALNETWORKS_RESHAPE, {op3, op4}, {op6});
+ model->addOperation(ANEURALNETWORKS_ADD, {op5, op6, act}, {op7});
+ // Phase 3, inputs and outputs
+ model->identifyInputsAndOutputs(
+ {op1, op3},
+ {op7});
+ 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", "{1, 1, 3, 4}")
+axis0 = Int32Scalar("axis0", 0)
+
+i3 = Input("op3", "TENSOR_FLOAT32", "{1, 2, 1, 1}")
+i4 = Parameter("op4", "TENSOR_INT32", "{4}", [1, 2, 1, 1])
+
+i5 = Internal("op5", "TENSOR_FLOAT32", "{1, 1, 3, 4}")
+i6 = Internal("op6", "TENSOR_FLOAT32", "{1, 2, 1, 1}")
+
+i7 = Output("op7", "TENSOR_FLOAT32", "{1, 2, 3, 4}")
+
+act = Int32Scalar("act", 0)
+
+model = model.Operation("CONCATENATION", i1, axis0).To(i5) # Actually NOP
+model = model.Operation("RESHAPE", i3, i4).To(i6) # Actually NOP
+model = model.Operation("ADD", i5, i6, act).To(i7)
+
+# Example 1. Input in operand 0,
+input0 = {i1: # input 0
+ [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
+ i3: # input 1
+ [100, 200]}
+
+output0 = {i7: # output 0
+ [101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212]}
+
+# Instantiate an example
+Example((input0, output0))