diff --git a/paddle/fluid/lite/kernels/arm/split_compute_test.cc b/paddle/fluid/lite/kernels/arm/split_compute_test.cc index 7d2d95205fc58a092be5714720c92382a9883a17..39632bee8decfe875f0adb3c2717d58e593c400b 100644 --- a/paddle/fluid/lite/kernels/arm/split_compute_test.cc +++ b/paddle/fluid/lite/kernels/arm/split_compute_test.cc @@ -27,7 +27,7 @@ void splite_resize_out(const lite::Tensor* din, const std::vector& dout, int axis, int num, const std::vector& sections) { auto in_dims = din->dims(); - int outs_number; + int outs_number = dout.size(); std::vector outs_dims; outs_dims.reserve(outs_number); @@ -118,11 +118,11 @@ TEST(split_arm, compute) { for (int i = 0; i < x.dims().production(); i++) { x_data[i] = i; } - for (auto out : output) delete out; for (auto out : output_ref) delete out; output.clear(); output_ref.clear(); + int outs_number; if (num > 0) { outs_number = num; @@ -133,7 +133,6 @@ TEST(split_arm, compute) { output.push_back(new lite::Tensor); output_ref.push_back(new lite::Tensor); } - splite_resize_out(&x, output, axis, num, sections); splite_resize_out(&x, output_ref, axis, num, sections); param.x = &x; diff --git a/paddle/fluid/lite/operators/split_op.cc b/paddle/fluid/lite/operators/split_op.cc index 299be81fc0b216b9b436866ea76ff4ce04051a96..9b4b7662ab7ba7228ee215bf051601150e2b6bb7 100644 --- a/paddle/fluid/lite/operators/split_op.cc +++ b/paddle/fluid/lite/operators/split_op.cc @@ -31,7 +31,7 @@ bool SplitOp::CheckShape() const { bool SplitOp::InferShape() const { const auto &outs = param_.output; - auto in_dims = param_.x.dims(); + auto in_dims = param_.x->dims(); int axis = param_.axis; int num = param_.num; const auto §ions = param_.sections; @@ -68,7 +68,7 @@ bool SplitOp::AttachImpl(const cpp::OpDesc &opdesc, lite::Scope *scope) { param_.sections = opdesc.GetAttr>("sections"); param_.x = const_cast( &scope->FindVar(opdesc.Input("X").front())->Get()); - auto outs = op_desc.Output("Out").front; + auto outs = opdesc.Output("Out"); for (auto var : outs) { param_.output.push_back(scope->FindVar(var)->GetMutable()); } diff --git a/paddle/fluid/lite/operators/split_op.h b/paddle/fluid/lite/operators/split_op.h index 177c44171e6e67214f820f04e801be6c01df01cc..20dc4b1028c27f4efab558694285e44d46182ef8 100644 --- a/paddle/fluid/lite/operators/split_op.h +++ b/paddle/fluid/lite/operators/split_op.h @@ -23,7 +23,7 @@ namespace paddle { namespace lite { namespace operators { -class SoftmaxOp : public OpLite { +class SplitOp : public OpLite { public: SplitOp() {} explicit SplitOp(const std::string &op_type) : OpLite(op_type) {}