reinterpret_cast<uint32_t*>(node.outputs->data)));
continue;
case tflite::BuiltinOperator_SPLIT:
+ add_split_params(node.builtin_data);
CHECK_NN(ANeuralNetworksModel_addOperationEx(
nn_model, ANEURALNETWORKS_SPLIT_EX,
static_cast<uint32_t>(augmented_inputs.size()),
}
}
};
+
+ auto add_split_params = [&add_scalar_int32](void* data) {
+ auto builtin = reinterpret_cast<TfLiteSplitParams*>(data);
+ add_scalar_int32(builtin->num_splits);
+ };
Param::Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount,
const uint32_t *outputs)
{
- assert(inputCount == 2);
+ assert(inputCount == 3);
// Each input should be interpreted as follows:
- // 0 -> A 0-D int32 tensor, indicating the dimension along which to split.
- // 1 -> An n-D tensor, specifying the tensor to be split.
- axis_index = inputs[0];
- ifm_index = inputs[1];
+ // 0 -> An n-D tensor, specifying the tensor to be split.
+ // 1 -> A 0-D int32 tensor, indicating the dimension along which to split.
+ // 2 -> A 0-D int32 tensor, indicating the number of outputs
+ // (It can be ignored on pacl becasue pacl don't support dynamic tensor shape,
+ // and can be used for verification only)
+ ifm_index = inputs[0];
+ axis_index = inputs[1];
// Each output should be interpreted as follow:
// [0, outputCount) -> An n-D tensor.
*/
struct Param
{
- int32_t axis_index; //!< index for axis
int32_t ifm_index; //!< index for input feature map
+ int32_t axis_index; //!< index for axis
std::vector<int32_t> ofm_indexes; //!< index for output feature map
model = Model()
i1 = Input("op1", "TENSOR_FLOAT32", "{8}")
axis = Int32Scalar("axis", 0)
+num_out = Int32Scalar("num_out", 8)
i2 = Output("op2", "TENSOR_FLOAT32", "{1}")
i3 = Output("op3", "TENSOR_FLOAT32", "{1}")
i4 = Output("op4", "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])
+model = model.Operation("SPLIT_EX", i1, axis, num_out).To([i2, i3, i4, i5, i6, i7, i8, i9])
# Example 1. Input in operand 0,
input0 = {i1: # input 0
model = Model()
i1 = Input("op1", "TENSOR_INT32", "{8}")
axis = Int32Scalar("axis", 0)
+num_out = Int32Scalar("num_out", 8)
i2 = Output("op2", "TENSOR_INT32", "{1}")
i3 = Output("op3", "TENSOR_INT32", "{1}")
i4 = Output("op4", "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])
+model = model.Operation("SPLIT_EX", i1, axis, num_out).To([i2, i3, i4, i5, i6, i7, i8, i9])
# Example 1. Input in operand 0,
input0 = {i1: # input 0
model = Model()
i1 = Input("op1", "TENSOR_FLOAT32", "{2,2,2,2}")
axis = Int32Scalar("axis", 0)
+num_out = Int32Scalar("num_out", 2)
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])
+model = model.Operation("SPLIT_EX", i1, axis, num_out).To([i2, i3])
# Example 1. Input in operand 0,
input0 = {i1: # input 0
model = Model()
i1 = Input("op1", "TENSOR_FLOAT32", "{2,2,2,2}")
axis = Int32Scalar("axis", 3)
+num_out = Int32Scalar("num_out", 2)
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])
+model = model.Operation("SPLIT_EX", i1, axis, num_out).To([i2, i3])
# Example 1. Input in operand 0,
input0 = {i1: # input 0
model = Model()
i1 = Input("op1", "TENSOR_FLOAT32", "{2,2,2,2}")
axis = Int32Scalar("axis", -4) # Negative axis
+num_out = Int32Scalar("num_out", 2)
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])
+model = model.Operation("SPLIT_EX", i1, axis, num_out).To([i2, i3])
# Example 1. Input in operand 0,
input0 = {i1: # input 0
model = Model()
i1 = Input("op1", "TENSOR_INT32", "{2,2,2,2}")
axis = Int32Scalar("axis", 0)
+num_out = Int32Scalar("num_out", 2)
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])
+model = model.Operation("SPLIT_EX", i1, axis, num_out).To([i2, i3])
# Example 1. Input in operand 0,
input0 = {i1: # input 0
model = Model()
i1 = Input("op1", "TENSOR_INT32", "{2,2,2,2}")
axis = Int32Scalar("axis", 1)
+num_out = Int32Scalar("num_out", 2)
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])
+model = model.Operation("SPLIT_EX", i1, axis, num_out).To([i2, i3])
# Example 1. Input in operand 0,
input0 = {i1: # input 0
model = Model()
i1 = Input("op1", "TENSOR_INT32", "{2,2,2,2}")
axis = Int32Scalar("axis", 2)
+num_out = Int32Scalar("num_out", 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])
+model = model.Operation("SPLIT_EX", i1, axis, num_out).To([i2, i3])
# Example 1. Input in operand 0,
input0 = {i1: # input 0
model = Model()
i1 = Input("op1", "TENSOR_INT32", "{2,2,2,2}")
axis = Int32Scalar("axis", 3)
+num_out = Int32Scalar("num_out", 2)
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])
+model = model.Operation("SPLIT_EX", i1, axis, num_out).To([i2, i3])
# Example 1. Input in operand 0,
input0 = {i1: # input 0
model = Model()
i1 = Input("op1", "TENSOR_INT32", "{2,2,2,2}")
axis = Int32Scalar("axis", -4) # Negative axis
+num_out = Int32Scalar("num_out", 2)
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])
+model = model.Operation("SPLIT_EX", i1, axis, num_out).To([i2, i3])
# Example 1. Input in operand 0,
input0 = {i1: # input 0
model = Model()
i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{2,2,2,2}, 0.5f, 1")
axis = Int32Scalar("axis", 0)
+num_out = Int32Scalar("num_out", 2)
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])
+model = model.Operation("SPLIT_EX", i1, axis, num_out).To([i2, i3])
# Example 1. Input in operand 0,
input0 = {i1: # input 0