This patch adds GTest for testing the enabled Broadcast of EqualEx op.
Added GTests:
```
equal_ex_broadcast
equal_ex_broadcast_4D_2D
```
Signed-off-by: prasannar <prasanna.r@samsung.com>
equal_ex_4D_float::examples);
}
+namespace equal_ex_broadcast_4D_2D {
+std::vector<MixedTypedExample> examples = {
+// Generated equal_ex_broadcast_4D_2D test
+#include "generated/examples/equal_ex_broadcast_4D_2D.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/equal_ex_broadcast_4D_2D.model.cpp"
+} // namespace equal_ex_broadcast_4D_2D
+TEST_F(GeneratedTests, equal_ex_broadcast_4D_2D) {
+ execute(equal_ex_broadcast_4D_2D::CreateModel,
+ equal_ex_broadcast_4D_2D::is_ignored,
+ equal_ex_broadcast_4D_2D::examples);
+}
+
+namespace equal_ex_broadcast {
+std::vector<MixedTypedExample> examples = {
+// Generated equal_ex_broadcast test
+#include "generated/examples/equal_ex_broadcast.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/equal_ex_broadcast.model.cpp"
+} // namespace equal_ex_broadcast
+TEST_F(GeneratedTests, equal_ex_broadcast) {
+ execute(equal_ex_broadcast::CreateModel,
+ equal_ex_broadcast::is_ignored,
+ equal_ex_broadcast::examples);
+}
+
namespace equal_ex_quant8 {
std::vector<MixedTypedExample> examples = {
// Generated equal_ex_quant8 test
--- /dev/null
+// Generated file (from: equal_ex_broadcast.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {123, 321, 2, 7}}, {1, {0, 7}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {{0, {0, 0, 0, 1}}}
+}
+}, // End of an example
--- /dev/null
+// Generated file (from: equal_ex_broadcast_4D_2D.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {4, 11, 9, 10, 8, 2, 1, 0, 3, 1, 8, 6, 11, 3, 8, 1, 0, 3, 2, 7, 4, 9, 11, 3}}, {1, {8, 3, 2, 10}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {{0, {0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0}}}
+}
+}, // End of an example
--- /dev/null
+// Generated file (from: equal_ex_broadcast.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type1(Type::TENSOR_FLOAT32, {1, 2});
+ OperandType type0(Type::TENSOR_FLOAT32, {2, 2});
+ OperandType type2(Type::TENSOR_QUANT8_ASYMM, {2, 2}, 1.f, 0);
+ // Phase 1, operands
+ auto op1 = model->addOperand(&type0);
+ auto op2 = model->addOperand(&type1);
+ auto op3 = model->addOperand(&type2);
+ // Phase 2, operations
+ model->addOperationEx(ANEURALNETWORKS_EQUAL_EX, {op1, 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: equal_ex_broadcast_4D_2D.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type1(Type::TENSOR_FLOAT32, {2, 2});
+ OperandType type0(Type::TENSOR_FLOAT32, {3, 2, 2, 2});
+ OperandType type2(Type::TENSOR_QUANT8_ASYMM, {3, 2, 2, 2}, 1.f, 0);
+ // Phase 1, operands
+ auto op1 = model->addOperand(&type0);
+ auto op2 = model->addOperand(&type1);
+ auto op3 = model->addOperand(&type2);
+ // Phase 2, operations
+ model->addOperationEx(ANEURALNETWORKS_EQUAL_EX, {op1, 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", "{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
+ [123, 321, 2, 7],
+ i2: # input 1
+ [0, 7]}
+
+output0 = {i3: # output 0
+ [0, 0, 0, 1]}
+
+# Instantiate an example
+Example((input0, output0))
--- /dev/null
+# 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, 11, 9, 10,
+ 8, 2, 1, 0,
+ 3, 1, 8, 6,
+ 11, 3, 8, 1,
+ 0, 3, 2, 7,
+ 4, 9, 11, 3],
+ i2: # input 1
+ [8, 3, 2, 10]}
+
+output0 = {i3: # output 0
+ [0, 0, 0, 1,
+ 1, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 1, 1, 0,
+ 0, 0, 0, 0]
+ }
+
+# Instantiate an example
+Example((input0, output0))