diff --git a/src/operators/fusion_conv_add_relu_op.h b/src/operators/fusion_conv_add_relu_op.h index 1335ce7b6ca5151e3d396856055f38825710f4b1..d70de4533723f843faa00c7243e4b9ab34e9e7b3 100644 --- a/src/operators/fusion_conv_add_relu_op.h +++ b/src/operators/fusion_conv_add_relu_op.h @@ -29,9 +29,8 @@ namespace operators { class FusionConvAddReluOpMatcher : public framework::FusionOpMatcher { public: FusionConvAddReluOpMatcher() { - node_ = framework::Node(G_OP_TYPE_CONV); - node_ > std::make_shared(G_OP_TYPE_ELEMENTWISE_ADD) > - std::make_shared(G_OP_TYPE_RELU); + node_ = framework::Node(G_OP_TYPE_FUSION_CONV_ADD); + node_ > std::make_shared(G_OP_TYPE_RELU); } void FolderNodes( diff --git a/src/operators/math/softmax.cpp b/src/operators/math/softmax.cpp index dba88c93969014f2ad0d2636b4141c734dbc2ed5..2ab9953d7350fa8cdb8edf1a74d16c9e41f5fee2 100644 --- a/src/operators/math/softmax.cpp +++ b/src/operators/math/softmax.cpp @@ -140,15 +140,24 @@ class SoftmaxFuntor { public: void operator()(const framework::Tensor *X, framework::Tensor *Y) { - const DDim dDim = X->dims(); - for (int i = 0; i < dDim[0]; ++i) { - framework::Tensor sub_X = X->Slice(i, i + 1); - framework::Tensor sub_Y = Y->Slice(i, i + 1); - + 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) { + framework::Tensor sub_X = X->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