target_include_directories(${LIB_NEURUN_BACKEND_ACL_CL} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${LIB_NEURUN_BACKEND_ACL_CL} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..)
-target_link_libraries(${LIB_NEURUN_BACKEND_ACL_CL} nnapi-header)
target_link_libraries(${LIB_NEURUN_BACKEND_ACL_CL} arm_compute)
target_link_libraries(${LIB_NEURUN_BACKEND_ACL_CL} arm_compute_ex)
target_link_libraries(${LIB_NEURUN_BACKEND_ACL_CL} ${LIB_NEURUN_KERNEL_ACL_CL})
#include "util/logging.h"
-#include "NeuralNetworks.h"
-
#include "util/Utils.h"
#include "acl_common/Convert.h"
void appendReLU6(::arm_compute::ICLTensor *tensor);
public:
- // TODO Remove NNAPI dependency
- void append(FuseCode code, ::arm_compute::ICLTensor *tensor);
void append(model::Activation code, ::arm_compute::ICLTensor *tensor);
private:
_builder.append(std::move(acl_fn));
}
-void ActivationBuilder::append(FuseCode code, ::arm_compute::ICLTensor *ifm_alloc)
-{
- switch (code)
- {
- case ANEURALNETWORKS_FUSED_NONE:
- {
- // DO NOTHING
- break;
- }
- case ANEURALNETWORKS_FUSED_RELU:
- {
- appendReLU(ifm_alloc);
- break;
- }
- case ANEURALNETWORKS_FUSED_RELU1:
- {
- appendReLU1(ifm_alloc);
- break;
- }
- case ANEURALNETWORKS_FUSED_RELU6:
- {
- appendReLU6(ifm_alloc);
- break;
- }
- default:
- {
- throw std::runtime_error("Not supported, yet");
- }
- }
-}
-
void ActivationBuilder::append(model::Activation code, ::arm_compute::ICLTensor *ifm_alloc)
{
switch (code)
target_include_directories(${LIB_NEURUN_KERNEL_ACL_CL} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..)
target_include_directories(${LIB_NEURUN_KERNEL_ACL_CL} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../..)
-target_link_libraries(${LIB_NEURUN_KERNEL_ACL_CL} nnapi-header)
target_link_libraries(${LIB_NEURUN_KERNEL_ACL_CL} arm_compute)
target_link_libraries(${LIB_NEURUN_KERNEL_ACL_CL} ${LIB_NEURUN_BACKEND_ACL_COMMON})
#include "util/logging.h"
-#include "NeuralNetworks.h"
-
#include "util/Utils.h"
#include "acl_common/Convert.h"
void appendReLU6(::arm_compute::ITensor *tensor);
public:
- // TODO Remove NNAPI dependency
- void append(FuseCode code, ::arm_compute::ITensor *tensor);
void append(model::Activation code, ::arm_compute::ITensor *tensor);
private:
_builder.append(std::move(acl_fn));
}
-void ActivationBuilder::append(FuseCode code, ::arm_compute::ITensor *ifm_alloc)
-{
- switch (code)
- {
- case ANEURALNETWORKS_FUSED_NONE:
- {
- // DO NOTHING
- break;
- }
- case ANEURALNETWORKS_FUSED_RELU:
- {
- appendReLU(ifm_alloc);
- break;
- }
- case ANEURALNETWORKS_FUSED_RELU1:
- {
- appendReLU1(ifm_alloc);
- break;
- }
- case ANEURALNETWORKS_FUSED_RELU6:
- {
- appendReLU6(ifm_alloc);
- break;
- }
- default:
- {
- throw std::runtime_error("Not supported, yet");
- }
- }
-}
-
void ActivationBuilder::append(model::Activation act, ::arm_compute::ITensor *ifm_alloc)
{
switch (act)
add_library(${LIB_NEURUN_BACKEND_CPU} SHARED ${SOURCES})
-target_link_libraries(${LIB_NEURUN_BACKEND_CPU} nnapi-header)
target_link_libraries(${LIB_NEURUN_BACKEND_CPU} nnfw_lib_misc)
target_link_libraries(${LIB_NEURUN_BACKEND_CPU} nnfw_lib_cpp14)
target_link_libraries(${LIB_NEURUN_BACKEND_CPU} ${LIB_NEURUN_KERNEL_CPU})
#ifndef __NEURUN_BACKEND_CPU_KERNEL_AVGPOOLLAYER_H__
#define __NEURUN_BACKEND_CPU_KERNEL_AVGPOOLLAYER_H__
-#include <NeuralNetworks.h>
-
#include <exec/IFunction.h>
#include "OperationUtils.h"
target_include_directories(${LIB_NEURUN_KERNEL_CPU} PUBLIC ${NEURUN_INCLUDE_DIR})
-target_link_libraries(${LIB_NEURUN_KERNEL_CPU} nnapi-header)
target_link_libraries(${LIB_NEURUN_KERNEL_CPU} nnfw_lib_misc nnfw_lib_cker)
set_target_properties(${LIB_NEURUN_KERNEL_CPU} PROPERTIES POSITION_INDEPENDENT_CODE ON)
#ifndef __NEURUN_BACKEND_CPU_KERNEL_CONCATLAYER_H__
#define __NEURUN_BACKEND_CPU_KERNEL_CONCATLAYER_H__
-#include <NeuralNetworks.h>
-
#include <exec/IFunction.h>
#include "OperationUtils.h"
#ifndef __NEURUN_BACKEND_CPU_KERNEL_CONVOLUTIONLAYER_H__
#define __NEURUN_BACKEND_CPU_KERNEL_CONVOLUTIONLAYER_H__
-#include <NeuralNetworks.h>
-
#include <exec/IFunction.h>
#include "OperationUtils.h"
#ifndef __NEURUN_KERNEL_CPU_DEPTHWISECONVOLUTIONLAYER_H__
#define __NEURUN_KERNEL_CPU_DEPTHWISECONVOLUTIONLAYER_H__
-#include <NeuralNetworks.h>
-
#include <exec/IFunction.h>
#include "OperationUtils.h"
#ifndef __NEURUN_BACKEND_CPU_KERNEL_FULLYCONNECTEDLAYER_H__
#define __NEURUN_BACKEND_CPU_KERNEL_FULLYCONNECTEDLAYER_H__
-#include <NeuralNetworks.h>
-
#include <exec/IFunction.h>
#include "OperationUtils.h"
#ifndef __NEURUN_BACKEND_CPU_KERNEL_MAXPOOLLAYER_H__
#define __NEURUN_BACKEND_CPU_KERNEL_MAXPOOLLAYER_H__
-#include <NeuralNetworks.h>
-
#include <exec/IFunction.h>
#include "OperationUtils.h"
*quantized_multiplier = static_cast<int32_t>(q_fixed);
}
-void CalculateActivationRangeFloat(int32_t activation, float *activation_min, float *activation_max)
-{
- if (activation == ANEURALNETWORKS_FUSED_RELU)
- {
- *activation_min = 0.f;
- *activation_max = std::numeric_limits<float>::max();
- }
- else if (activation == ANEURALNETWORKS_FUSED_RELU6)
- {
- *activation_min = 0.f;
- *activation_max = 6.f;
- }
- else if (activation == ANEURALNETWORKS_FUSED_RELU1)
- {
- *activation_min = -1.f;
- *activation_max = 1.f;
- }
- else if (activation == ANEURALNETWORKS_FUSED_NONE)
- {
- *activation_min = std::numeric_limits<float>::lowest();
- *activation_max = std::numeric_limits<float>::max();
- }
- else
- {
- std::cout << "Unsupported fused activation function." << std::endl;
- }
-}
-
void CalculateActivationRangeFloat(model::Activation activation, float *activation_min,
float *activation_max)
{
}
}
-void CalculateActivationRangeUint8(int32_t activation, const Shape &outputShape, int32_t *act_min,
- int32_t *act_max)
-{
- const int32_t qmin = std::numeric_limits<uint8_t>::min();
- const int32_t qmax = std::numeric_limits<uint8_t>::max();
- const auto scale = outputShape.scale;
- const auto zero_point = outputShape.offset;
- auto quantize = [scale, zero_point](float f) {
- return zero_point + static_cast<int32_t>(std::round(f / scale));
- };
- if (activation == ANEURALNETWORKS_FUSED_RELU)
- {
- *act_min = std::max(qmin, quantize(0.0));
- *act_max = qmax;
- }
- else if (activation == ANEURALNETWORKS_FUSED_RELU6)
- {
- *act_min = std::max(qmin, quantize(0.0));
- *act_max = std::min(qmax, quantize(6.0));
- }
- else if (activation == ANEURALNETWORKS_FUSED_RELU1)
- {
- *act_min = std::max(qmin, quantize(-1.0));
- *act_max = std::min(qmax, quantize(1.0));
- }
- else if (activation == ANEURALNETWORKS_FUSED_NONE)
- {
- *act_min = qmin;
- *act_max = qmax;
- }
- else
- {
- std::cout << "Unsupported fused activation function." << std::endl;
- }
-}
-
void CalculateActivationRangeUint8(model::Activation activation, const Shape &outputShape,
int32_t *act_min, int32_t *act_max)
{
#ifndef __NNFW_SUPPORT_NNAPI_OPERATION_UTILS_H__
#define __NNFW_SUPPORT_NNAPI_OPERATION_UTILS_H__
-#include <NeuralNetworks.h>
-
#include <iostream>
#include <limits>
#include <vector>
void QuantizeMultiplierGreaterThanOne(double double_multiplier, int32_t *quantized_multiplier,
int *left_shift);
-// TODO Remove CalculateActivationRangeFloat(int32_t, float*, float*)
-void CalculateActivationRangeFloat(int32_t activation, float *activation_min,
- float *activation_max);
void CalculateActivationRangeFloat(model::Activation activation, float *activation_min,
float *activation_max);
-// TODO Remove int32_t(FuseCode) activation CalculateActivationRangeUint8(int32_t, Shape, int32_t*,
-// int32_t*)
-void CalculateActivationRangeUint8(int32_t activation, const Shape &outputShape, int32_t *act_min,
- int32_t *act_max);
void CalculateActivationRangeUint8(model::Activation activation, const Shape &outputShape,
int32_t *act_min, int32_t *act_max);
#ifndef __NEURUN_BACKEND_CPU_KERNEL_PERMUTE_LAYER_H__
#define __NEURUN_BACKEND_CPU_KERNEL_PERMUTE_LAYER_H__
-#include <NeuralNetworks.h>
-
#include <exec/IFunction.h>
#include "util/feature/nhwc/View.h"
#ifndef __NEURUN_BACKEND_CPU_KERNEL_RESHAPELAYER_H__
#define __NEURUN_BACKEND_CPU_KERNEL_RESHAPELAYER_H__
-#include <NeuralNetworks.h>
-
#include <exec/IFunction.h>
#include "OperationUtils.h"
#ifndef __NEURUN_BACKEND_CPU_KERNEL_SOFTMAXLAYER_H__
#define __NEURUN_BACKEND_CPU_KERNEL_SOFTMAXLAYER_H__
-#include <NeuralNetworks.h>
-
#include <exec/IFunction.h>
#include "OperationUtils.h"
set_target_properties(neurun-core PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_include_directories(neurun-core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(neurun-core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
-target_link_libraries(neurun-core nnapi-header) # TODO Remove this dependency
target_link_libraries(neurun-core nnfw_lib_misc nnfw_lib_cpp14 dl)
target_compile_options(neurun-core PRIVATE -Wall -Wextra -Werror)
#ifndef __NEURUN_UTIL_UTILS_H__
#define __NEURUN_UTIL_UTILS_H__
-// TODO remove include "NeuralNetworks.h"
-#include "NeuralNetworks.h"
#include "model/InternalType.h"
#define UNUSED_RELEASE(a) (void)(a)
#define __NEURUN_UTIL_FEATURE_NHWC_VIEW_H__
#include <cassert>
+#include <cstddef>
#include "Utils.h"
#include "util/Utils.h"