Skip to content

Commit 7b3f2de

Browse files
authored
Merge pull request #1230 from yangfei963158659/develop
repair bug of softmax and conv_add_relu op
2 parents cf51610 + 643f397 commit 7b3f2de

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

src/operators/fusion_conv_add_relu_op.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ namespace operators {
2929
class FusionConvAddReluOpMatcher : public framework::FusionOpMatcher {
3030
public:
3131
FusionConvAddReluOpMatcher() {
32-
node_ = framework::Node(G_OP_TYPE_CONV);
33-
node_ > std::make_shared<framework::Node>(G_OP_TYPE_ELEMENTWISE_ADD) >
34-
std::make_shared<framework::Node>(G_OP_TYPE_RELU);
32+
// node_ = framework::Node(G_OP_TYPE_FUSION_CONV_ADD);
33+
// node_ > std::make_shared<framework::Node>(G_OP_TYPE_RELU);
3534
}
3635

3736
void FolderNodes(

src/operators/math/softmax.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,21 @@ class SoftmaxFuntor<CPU, T> {
141141
public:
142142
void operator()(const framework::Tensor *X, framework::Tensor *Y) {
143143
const DDim dDim = X->dims();
144+
int dim1 = dDim[dDim.size() - 1];
145+
int dim0 = X->numel() / dim1 / dDim[0];
146+
framework::DDim matrix_shape = {dim0, dim1};
144147
for (int i = 0; i < dDim[0]; ++i) {
145148
framework::Tensor sub_X = X->Slice(i, i + 1);
146149
framework::Tensor sub_Y = Y->Slice(i, i + 1);
147-
150+
sub_X.Resize(matrix_shape);
151+
sub_Y.Resize(matrix_shape);
152+
for (int j = 0; j < dim0; j++) {
153+
framework::Tensor sub_x = sub_X.Slice(j, j + 1);
154+
framework::Tensor sub_y = sub_Y.Slice(j, j + 1);
148155
#ifdef __ARM_NEON
149-
SoftmaxCacl(&sub_X, &sub_Y);
156+
SoftmaxCacl(&sub_x, &sub_y);
150157
#endif
158+
}
151159
}
152160
}
153161
};

tools/android-debug-script/push2android.sh

+8-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ MODELS_PATH="../../test/models/*"
55
MODELS_SRC="../../test/models"
66
IMAGE_PATH="../../test/images/*"
77
EXE_FILE="../../test/build/*"
8-
EXE_DIR="data/local/tmp/bin"
8+
EXE_DIR="/data/local/tmp/bin"
99
adb shell mkdir ${EXE_DIR}
10-
MODELS_DIR="data/local/tmp/models"
10+
MODELS_DIR="/data/local/tmp/models"
1111
adb shell mkdir ${MODELS_DIR}
1212
for file in `ls ${MODELS_SRC}`
1313
do
@@ -19,11 +19,15 @@ ACL_BUILD_PATH="../../src/operators/kernel/mali/ACL_Android/build/*"
1919
adb push ${ACL_BUILD_PATH} ${EXE_DIR}
2020
fi
2121

22-
IMAGES_DIR="data/local/tmp/images"
22+
IMAGES_DIR="/data/local/tmp/images"
2323
adb shell mkdir ${IMAGES_DIR}
2424
LIB_PATH="../../build/release/arm-v7a/build/*"
2525
adb push ${EXE_FILE} ${EXE_DIR}
26-
adb push ${LIB_PATH} ${EXE_DIR}
26+
for file in ${LIB_PATH}
27+
do
28+
adb push ${file} ${EXE_DIR}
29+
done
30+
2731
if [[ $1 != "npm" ]]; then
2832
adb push ${IMAGE_PATH} ${IMAGES_DIR}
2933
adb push ${MODELS_PATH} ${MODELS_DIR}

0 commit comments

Comments
 (0)