diff --git a/paddle/fluid/inference/api/analysis_predictor.cc b/paddle/fluid/inference/api/analysis_predictor.cc index 4ef15fbbc15dcbc4bfd31f8047817f342b309d43..e46d4c600dc74e6540e6314cdea99f7498213a82 100644 --- a/paddle/fluid/inference/api/analysis_predictor.cc +++ b/paddle/fluid/inference/api/analysis_predictor.cc @@ -1151,10 +1151,15 @@ bool AnalysisPredictor::SetFeed(const std::vector &inputs, feeds_.size(), inputs.size())); for (size_t i = 0; i < inputs.size(); ++i) { - PADDLE_ENFORCE_EQ(inputs[i].initialized(), + PADDLE_ENFORCE_EQ(inputs[i].defined(), true, paddle::platform::errors::InvalidArgument( - "The input Tensor expected to be initialized.")); + "The input Tensor expected to be defined.")); + PADDLE_ENFORCE_EQ( + inputs[i].is_dense_tensor(), + true, + paddle::platform::errors::InvalidArgument( + "The input Tensor expected to be type of dense tensor.")); } if (std::all_of(inputs.cbegin(), inputs.cend(), [&](const paddle::Tensor &t) {