提交 20fbc1af 编写于 作者: Y yangfei

repair bug of softmax and conv_add_relu op

上级 bbb18e59
...@@ -29,9 +29,8 @@ namespace operators { ...@@ -29,9 +29,8 @@ namespace operators {
class FusionConvAddReluOpMatcher : public framework::FusionOpMatcher { class FusionConvAddReluOpMatcher : public framework::FusionOpMatcher {
public: public:
FusionConvAddReluOpMatcher() { FusionConvAddReluOpMatcher() {
node_ = framework::Node(G_OP_TYPE_CONV); node_ = framework::Node(G_OP_TYPE_FUSION_CONV_ADD);
node_ > std::make_shared<framework::Node>(G_OP_TYPE_ELEMENTWISE_ADD) > node_ > std::make_shared<framework::Node>(G_OP_TYPE_RELU);
std::make_shared<framework::Node>(G_OP_TYPE_RELU);
} }
void FolderNodes( void FolderNodes(
......
...@@ -141,13 +141,21 @@ class SoftmaxFuntor<CPU, T> { ...@@ -141,13 +141,21 @@ class SoftmaxFuntor<CPU, T> {
public: public:
void operator()(const framework::Tensor *X, framework::Tensor *Y) { void operator()(const framework::Tensor *X, framework::Tensor *Y) {
const DDim dDim = X->dims(); const DDim dDim = X->dims();
int dim1 = dDim[dDim.size() - 1];
int dim0 = X->numel() / dim1 / dDim[0];
framework::DDim matrix_shape = {dim0, dim1};
for (int i = 0; i < dDim[0]; ++i) { for (int i = 0; i < dDim[0]; ++i) {
framework::Tensor sub_X = X->Slice(i, i + 1); framework::Tensor sub_X = X->Slice(i, i + 1);
framework::Tensor sub_Y = Y->Slice(i, i + 1); framework::Tensor sub_Y = Y->Slice(i, i + 1);
sub_X.Resize(matrix_shape);
sub_Y.Resize(matrix_shape);
for (int j = 0; j < dim0; j++) {
framework::Tensor sub_x = sub_X.Slice(j, j + 1);
framework::Tensor sub_y = sub_Y.Slice(j, j + 1);
#ifdef __ARM_NEON #ifdef __ARM_NEON
SoftmaxCacl(&sub_X, &sub_Y); SoftmaxCacl(&sub_x, &sub_y);
#endif #endif
}
} }
} }
}; };
......
...@@ -5,9 +5,9 @@ MODELS_PATH="../../test/models/*" ...@@ -5,9 +5,9 @@ MODELS_PATH="../../test/models/*"
MODELS_SRC="../../test/models" MODELS_SRC="../../test/models"
IMAGE_PATH="../../test/images/*" IMAGE_PATH="../../test/images/*"
EXE_FILE="../../test/build/*" EXE_FILE="../../test/build/*"
EXE_DIR="data/local/tmp/bin" EXE_DIR="/data/local/tmp/bin"
adb shell mkdir ${EXE_DIR} adb shell mkdir ${EXE_DIR}
MODELS_DIR="data/local/tmp/models" MODELS_DIR="/data/local/tmp/models"
adb shell mkdir ${MODELS_DIR} adb shell mkdir ${MODELS_DIR}
for file in `ls ${MODELS_SRC}` for file in `ls ${MODELS_SRC}`
do do
...@@ -19,11 +19,15 @@ ACL_BUILD_PATH="../../src/operators/kernel/mali/ACL_Android/build/*" ...@@ -19,11 +19,15 @@ ACL_BUILD_PATH="../../src/operators/kernel/mali/ACL_Android/build/*"
adb push ${ACL_BUILD_PATH} ${EXE_DIR} adb push ${ACL_BUILD_PATH} ${EXE_DIR}
fi fi
IMAGES_DIR="data/local/tmp/images" IMAGES_DIR="/data/local/tmp/images"
adb shell mkdir ${IMAGES_DIR} adb shell mkdir ${IMAGES_DIR}
LIB_PATH="../../build/release/arm-v7a/build/*" LIB_PATH="../../build/release/arm-v7a/build/*"
adb push ${EXE_FILE} ${EXE_DIR} adb push ${EXE_FILE} ${EXE_DIR}
adb push ${LIB_PATH} ${EXE_DIR} for file in ${LIB_PATH}
do
adb push ${file} ${EXE_DIR}
done
if [[ $1 != "npm" ]]; then if [[ $1 != "npm" ]]; then
adb push ${IMAGE_PATH} ${IMAGES_DIR} adb push ${IMAGE_PATH} ${IMAGES_DIR}
adb push ${MODELS_PATH} ${MODELS_DIR} adb push ${MODELS_PATH} ${MODELS_DIR}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册