const auto ifm_index{node.getInputs().at(model::operation::MeanNode::Input::INPUT)};
const auto axis_index{node.param().axis_index};
- const auto keep_dims_index{node.param().keep_dims_index};
- (void)keep_dims_index;
+ const auto keep_dims{node.param().keep_dims};
+ (void)keep_dims;
const auto ifm_shape = _ctx.at(ifm_index).shape();
const auto ifm_index{node.getInputs().at(model::operation::MeanNode::Input::INPUT)};
const auto axis_index{node.param().axis_index};
- const auto keep_dims_index{node.param().keep_dims_index};
+ const auto keep_dims{node.param().keep_dims};
const auto ifm_shape = _ctx.at(ifm_index).shape();
fixed_axis.set(fixed_axis.num_dimensions(), a);
}
- bool keep_dims = _ctx.at(keep_dims_index).asScalar<int32_t>() != 0;
-
std::unique_ptr<::arm_compute::IFunction> fn;
// NOTE NEReduceMean has a bug that does not support NHWC layout
struct Param
{
OperandIndex axis_index;
- OperandIndex keep_dims_index;
+ bool keep_dims;
};
public:
};
_map[ANEURALNETWORKS_MEAN] = [](const OperationFactory::Param &init_param,
- neurun::model::Operands &) {
+ neurun::model::Operands &operands) {
assert(init_param.input_count == 3 && init_param.output_count == 1);
OperandIndexSequence outputs{init_param.outputs[0]};
operation::MeanNode::Param param;
param.axis_index = OperandIndex{init_param.inputs[1]};
- param.keep_dims_index = OperandIndex{init_param.inputs[2]};
+ param.keep_dims = operands.at(OperandIndex{init_param.inputs[2]}).asScalar<int32_t>() != 0;
return new operation::MeanNode{inputs, outputs, param};
};
_graph.addOperation(std::move(new_op));
}
+void Loader::loadMean(const tflite::Operator *op)
+{
+ model::OperandIndexSequence inputs;
+ model::OperandIndexSequence outputs;
+
+ const auto input_index = (*op->inputs())[0];
+ inputs.append(model::OperandIndex(input_index));
+ const auto output_index = (*op->outputs())[0];
+ outputs.append(model::OperandIndex(output_index));
+
+ model::operation::MeanNode::Param param;
+ param.axis_index = model::OperandIndex((*op->inputs())[1]);
+ param.keep_dims = op->builtin_options_as_ReducerOptions()->keep_dims();
+
+ std::unique_ptr<model::Operation> new_op(new model::operation::MeanNode(inputs, outputs, param));
+ _graph.addOperation(std::move(new_op));
+}
+
void Loader::loadCustom(const tflite::Operator *op)
{
model::OperandIndexSequence inputs;
case BuiltinOperator_TRANSPOSE:
loadTranspose(op);
return;
+ case BuiltinOperator_MEAN:
+ loadMean(op);
+ return;
case BuiltinOperator_CUSTOM:
loadCustom(op);
return;
void loadSquaredDifference(const tflite::Operator *op);
void loadTanh(const tflite::Operator *op);
void loadTranspose(const tflite::Operator *op);
+ void loadMean(const tflite::Operator *op);
void loadCustom(const tflite::Operator *op);