diff --git a/paddle/fluid/lite/operators/CMakeLists.txt b/paddle/fluid/lite/operators/CMakeLists.txt index 536fcb75ef47c33c3bb0ef1996526fca50bf5497..1a7ac5bd5704e040498eb1dfb2f51f5429b9d7c0 100644 --- a/paddle/fluid/lite/operators/CMakeLists.txt +++ b/paddle/fluid/lite/operators/CMakeLists.txt @@ -20,7 +20,7 @@ cc_library(fill_constant_op_lite SRCS fill_constant_op.cc DEPS ${op_DEPS}) cc_library(op_params_lite SRCS op_params.cc DEPS ${tensor_lite} any_lite framework_proto_lite) cc_library(dropout_op_lite SRCS dropout_op.cc DEPS ${op_DEPS}) cc_library(concat_op_lite SRCS concat_op.cc DEPS ${op_DEPS}) -# cc_library(split_op_lite SRCS split_op.cc DEPS ${op_DEPS}) +cc_library(split_op_lite SRCS split_op.cc DEPS ${op_DEPS}) set(ops_lite conv_op_lite @@ -41,7 +41,7 @@ set(ops_lite activation_ops_lite dropout_op_lite concat_op_lite - #split_op_lite + split_op_lite PARENT_SCOPE) lite_cc_test(test_fc_op_lite SRCS fc_op_test.cc diff --git a/paddle/fluid/lite/operators/split_op.cc b/paddle/fluid/lite/operators/split_op.cc index 58768276377edd9ea92356a808a6f46c3b5c6a80..1f220819db61d17b27cb06d4928ae52c5eb7f7eb 100644 --- a/paddle/fluid/lite/operators/split_op.cc +++ b/paddle/fluid/lite/operators/split_op.cc @@ -48,7 +48,7 @@ bool SplitOp::InferShape() const { outs_dims.push_back(dim); } } else if (sections.size() > 0) { - for (size_t i = 0; i < outs_number; ++i) { + for (int i = 0; i < outs_number; ++i) { auto dim = in_dims; dim[axis] = sections[i]; outs_dims.push_back(dim); @@ -66,9 +66,9 @@ bool SplitOp::AttachImpl(const cpp::OpDesc &opdesc, lite::Scope *scope) { param_.axis = opdesc.GetAttr("axis"); param_.num = opdesc.GetAttr("num"); param_.sections = opdesc.GetAttr>("sections"); - param_.x = const_cast( - &scope->FindVar(opdesc.Input("X").front())->Get()); + auto input = opdesc.Input("Input").front(); auto outs = opdesc.Output("Out"); + param_.x = scope->FindVar(input)->GetMutable(); for (auto var : outs) { param_.output.push_back(scope->FindVar(var)->GetMutable()); }