From: Prasanna R/SNAP /SRI-Bangalore/Engineer/삼성전자 Date: Wed, 5 Dec 2018 06:08:02 +0000 (+0530) Subject: Changes in PACK GTest as per specifications in NNAPI (#3866) X-Git-Tag: 0.3~201 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1af5d9b2768773e7bc995c4c7bc20a9ec513f61d;p=platform%2Fcore%2Fml%2Fnnfw.git Changes in PACK GTest as per specifications in NNAPI (#3866) This patch makes changes in PACK GTests as per specification in NNAPI. Refer #3864 for specification. Signed-off-by: prasannar --- diff --git a/runtimes/tests/neural_networks_test/generated/models/pack_ex_3D_float.model.cpp b/runtimes/tests/neural_networks_test/generated/models/pack_ex_3D_float.model.cpp index afc71cd..521b5cd 100644 --- a/runtimes/tests/neural_networks_test/generated/models/pack_ex_3D_float.model.cpp +++ b/runtimes/tests/neural_networks_test/generated/models/pack_ex_3D_float.model.cpp @@ -7,12 +7,15 @@ void CreateModel(Model *model) { auto input1 = model->addOperand(&type0); auto input2 = model->addOperand(&type0); auto input3 = model->addOperand(&type0); + auto num = model->addOperand(&type1); auto axis = model->addOperand(&type1); auto output = model->addOperand(&type2); // Phase 2, operations + static int32_t num_init[] = {3}; + model->setOperandValue(num, num_init, sizeof(int32_t) * 1); static int32_t axis_init[] = {0}; model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1); - model->addOperationEx(ANEURALNETWORKS_PACK_EX, {input1, input2, input3, axis}, {output}); + model->addOperationEx(ANEURALNETWORKS_PACK_EX, {input1, input2, input3, num, axis}, {output}); // Phase 3, inputs and outputs model->identifyInputsAndOutputs( {input1, input2, input3}, diff --git a/runtimes/tests/neural_networks_test/generated/models/pack_ex_3D_float2.model.cpp b/runtimes/tests/neural_networks_test/generated/models/pack_ex_3D_float2.model.cpp index 0ec1d60..67dd00a 100644 --- a/runtimes/tests/neural_networks_test/generated/models/pack_ex_3D_float2.model.cpp +++ b/runtimes/tests/neural_networks_test/generated/models/pack_ex_3D_float2.model.cpp @@ -7,12 +7,15 @@ void CreateModel(Model *model) { auto input1 = model->addOperand(&type0); auto input2 = model->addOperand(&type0); auto input3 = model->addOperand(&type0); + auto num = model->addOperand(&type1); auto axis = model->addOperand(&type1); auto output = model->addOperand(&type2); // Phase 2, operations + static int32_t num_init[] = {3}; + model->setOperandValue(num, num_init, sizeof(int32_t) * 1); static int32_t axis_init[] = {2}; model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1); - model->addOperationEx(ANEURALNETWORKS_PACK_EX, {input1, input2, input3, axis}, {output}); + model->addOperationEx(ANEURALNETWORKS_PACK_EX, {input1, input2, input3, num, axis}, {output}); // Phase 3, inputs and outputs model->identifyInputsAndOutputs( {input1, input2, input3}, diff --git a/runtimes/tests/neural_networks_test/specs/Ex/pack_ex_3D_float.mod.py b/runtimes/tests/neural_networks_test/specs/Ex/pack_ex_3D_float.mod.py index c9a94b0..f9dd1e8 100644 --- a/runtimes/tests/neural_networks_test/specs/Ex/pack_ex_3D_float.mod.py +++ b/runtimes/tests/neural_networks_test/specs/Ex/pack_ex_3D_float.mod.py @@ -3,9 +3,10 @@ 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", 3) axis = Int32Scalar("axis", 0) out = Output("output", "TENSOR_FLOAT32", "{3, 2, 3, 4}") -model = model.Operation("PACK_EX", i1, i2, i3, axis).To(out) +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], diff --git a/runtimes/tests/neural_networks_test/specs/Ex/pack_ex_3D_float2.mod.py b/runtimes/tests/neural_networks_test/specs/Ex/pack_ex_3D_float2.mod.py index b150e3e..7d83cd8 100644 --- a/runtimes/tests/neural_networks_test/specs/Ex/pack_ex_3D_float2.mod.py +++ b/runtimes/tests/neural_networks_test/specs/Ex/pack_ex_3D_float2.mod.py @@ -3,9 +3,10 @@ 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", 3) axis = Int32Scalar("axis", 2) out = Output("output", "TENSOR_FLOAT32", "{2, 3, 3, 4}") -model = model.Operation("PACK_EX", i1, i2, i3, axis).To(out) +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],