NEUniqueTensor bias(arm_compute::TensorInfo(bias_shape, arm_compute::Format::F32));
NEUniqueTensor filter(arm_compute::TensorInfo(filter_shape, arm_compute::Format::F32));
- assert(activation == ANEURALNETWORKS_FUSED_NONE || activation == ANEURALNETWORKS_FUSED_RELU);
-
std::vector<std::shared_ptr<arm_compute::IFunction>> fns;
auto conv_f = std::make_shared<arm_compute::NEConvolutionLayer>();
fns.emplace_back(conv_f);
- if (ANEURALNETWORKS_FUSED_RELU == activation)
- {
- auto relu_f = std::make_shared<arm_compute::NEActivationLayer>();
-
- const arm_compute::ActivationLayerInfo relu_info{arm_compute::ActivationLayerInfo::ActivationFunction::RELU};
-
- // Do in-place update
- relu_f->configure(output.ptr(), nullptr, relu_info);
-
- fns.emplace_back(relu_f);
- }
+ util::insertFusedActivationLayer<NEUniqueTensor, arm_compute::NEActivationLayer>(output, activation, fns);
input.allocate();
output.allocate();
arm_compute::TensorShape input_shape = util::fromNNShape(inputShape);
arm_compute::TensorShape output_shape = util::fromNNShape(outputShape);
- assert(activation == ANEURALNETWORKS_FUSED_NONE || activation == ANEURALNETWORKS_FUSED_RELU);
-
std::vector<std::shared_ptr<arm_compute::IFunction>> fns;
arm_compute::PadStrideInfo pad_info = arm_compute::PadStrideInfo(stride_width, stride_height,
fns.emplace_back(pool_f);
- if (ANEURALNETWORKS_FUSED_RELU == activation)
- {
- auto relu_f = std::make_shared<arm_compute::NEActivationLayer>();
-
- const arm_compute::ActivationLayerInfo relu_info{arm_compute::ActivationLayerInfo::ActivationFunction::RELU};
+ util::insertFusedActivationLayer<NEUniqueTensor, arm_compute::NEActivationLayer>(output, activation, fns);
- // Do in-place update
- relu_f->configure(output.ptr(), nullptr, relu_info);
-
- fns.emplace_back(relu_f);
- }
-
input.allocate();
output.allocate();
arm_compute::TensorShape input_shape = util::fromNNShape(inputShape);
arm_compute::TensorShape output_shape = util::fromNNShape(outputShape);
- assert(activation == ANEURALNETWORKS_FUSED_NONE || activation == ANEURALNETWORKS_FUSED_RELU);
-
std::vector<std::shared_ptr<arm_compute::IFunction>> fns;
arm_compute::PadStrideInfo pad_info = arm_compute::PadStrideInfo(stride_width, stride_height,
fns.emplace_back(pool_f);
- if (ANEURALNETWORKS_FUSED_RELU == activation)
- {
- auto relu_f = std::make_shared<arm_compute::NEActivationLayer>();
-
- const arm_compute::ActivationLayerInfo relu_info{arm_compute::ActivationLayerInfo::ActivationFunction::RELU};
-
- // Do in-place update
- relu_f->configure(output.ptr(), nullptr, relu_info);
-
- fns.emplace_back(relu_f);
- }
+ util::insertFusedActivationLayer<NEUniqueTensor, arm_compute::NEActivationLayer>(output, activation, fns);
input.allocate();
output.allocate();