diff --git a/src/common/types.cpp b/src/common/types.cpp index b90fb70f2a81b365f049632cc7281a69ec58e18d..ede49478ce1a56ca603f5f8580d4d0c231d6616d 100644 --- a/src/common/types.cpp +++ b/src/common/types.cpp @@ -82,6 +82,7 @@ std::unordered_map< {G_OP_TYPE_FUSION_CONV_ADD, {{"Input"}, {"Out"}}}, {G_OP_TYPE_RELU, {{"X"}, {"Out"}}}, {G_OP_TYPE_SOFTMAX, {{"X"}, {"Out"}}}, + {G_OP_TYPE_SIGMOID, {{"X"}, {"Out"}}}, {G_OP_TYPE_MUL, {{"X"}, {"Out"}}}, {G_OP_TYPE_ELEMENTWISE_ADD, {{"X", "Y"}, {"Out"}}}, {G_OP_TYPE_POOL2D, {{"X"}, {"Out"}}}, diff --git a/src/framework/loader.cpp b/src/framework/loader.cpp index eb07e9f6155370880f6fb8e302a8e396df17954d..5587d0698fa2b9a04532deae618545d15ecd631f 100644 --- a/src/framework/loader.cpp +++ b/src/framework/loader.cpp @@ -44,7 +44,12 @@ void Loader::InitMemoryFromProgram( } else { auto dim = var_desc->Tensor_desc().Dims(); PADDLE_MOBILE_ENFORCE(dim.size() > 0, "dim size is 0"); - dim[0] = 1; + // dim[0] = 1; + for (auto &d : dim) { + if (d < 0) { + d *= -1; + } + } auto tensor = var->GetMutable(); tensor->Resize(make_ddim(dim)); } diff --git a/src/operators/op_param.h b/src/operators/op_param.h index 058c1bcf3a0bfb77c1f6104bf417ac13995e34fd..5666f8e9c97482c13414fc9c4d4b54e7f96bcbca 100644 --- a/src/operators/op_param.h +++ b/src/operators/op_param.h @@ -1338,23 +1338,23 @@ class Reshape2Param : public OpParam { } } - const RType *InputX() const { return input_x_; } + const GType *InputX() const { return input_x_; } - const RType *InputShape() const { return input_shape_; } + const GType *InputShape() const { return input_shape_; } - RType *Out() const { return out_; } + GType *Out() const { return out_; } - RType *OutputXShape() const { return output_xshape_; } + GType *OutputXShape() const { return output_xshape_; } const vector &Shape() const { return shape_; } const bool &Inplace() const { return inplace_; } private: - RType *input_x_; - RType *input_shape_; - RType *out_; - RType *output_xshape_; + GType *input_x_; + GType *input_shape_; + GType *out_; + GType *output_xshape_; vector shape_; bool inplace_; };