未验证 提交 d8b40223 编写于 作者: J JingZhuangzhuang 提交者: GitHub

fix_trt_engine_op_bug (#40067)

上级 b1d38dea
...@@ -80,6 +80,8 @@ using inference::tensorrt::TRTCalibratorEngine; ...@@ -80,6 +80,8 @@ using inference::tensorrt::TRTCalibratorEngine;
using inference::tensorrt::TRTCalibratorEngineManager; using inference::tensorrt::TRTCalibratorEngineManager;
#endif #endif
int AnalysisPredictor::clone_num_ = 1;
namespace { namespace {
bool IsPersistable(const framework::VarDesc *var) { bool IsPersistable(const framework::VarDesc *var) {
if (var->Persistable() && if (var->Persistable() &&
...@@ -1633,7 +1635,7 @@ std::unique_ptr<PaddlePredictor> AnalysisPredictor::Clone() { ...@@ -1633,7 +1635,7 @@ std::unique_ptr<PaddlePredictor> AnalysisPredictor::Clone() {
std::lock_guard<std::mutex> lk(clone_mutex_); std::lock_guard<std::mutex> lk(clone_mutex_);
auto *x = new AnalysisPredictor(config_); auto *x = new AnalysisPredictor(config_);
x->Init(scope_, inference_program_); x->Init(scope_, inference_program_);
x->executor_->ResetTrtOps(++x->clone_num_); x->executor_->ResetTrtOps(++AnalysisPredictor::clone_num_);
return std::unique_ptr<PaddlePredictor>(x); return std::unique_ptr<PaddlePredictor>(x);
} }
......
...@@ -486,7 +486,7 @@ class AnalysisPredictor : public PaddlePredictor { ...@@ -486,7 +486,7 @@ class AnalysisPredictor : public PaddlePredictor {
bool status_is_cloned_{false}; bool status_is_cloned_{false};
std::map<std::string, std::vector<std::vector<int32_t>>> shape_info_; std::map<std::string, std::vector<std::vector<int32_t>>> shape_info_;
int clone_num_{1}; static int clone_num_;
#if defined(PADDLE_WITH_DISTRIBUTE) && defined(PADDLE_WITH_PSCORE) && \ #if defined(PADDLE_WITH_DISTRIBUTE) && defined(PADDLE_WITH_PSCORE) && \
!defined(PADDLE_WITH_ASCEND_CL) !defined(PADDLE_WITH_ASCEND_CL)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册