From 72e235d02037a5460a0114111ebd8ba902ec4644 Mon Sep 17 00:00:00 2001 From: Yuanle Liu Date: Thu, 4 May 2023 11:17:09 +0800 Subject: [PATCH] tensor should be defined (#53449) --- paddle/fluid/inference/api/analysis_predictor.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/inference/api/analysis_predictor.cc b/paddle/fluid/inference/api/analysis_predictor.cc index 4ef15fbbc15..e46d4c600dc 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) { -- GitLab