From 1da32806600a653c87e9e7186c039b524e63485c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E6=99=93=E4=BC=9F?= <39303645+Shixiaowei02@users.noreply.github.com> Date: Sun, 28 Feb 2021 11:12:54 +0800 Subject: [PATCH] inference modification for custom operator, test=develop (#31283) --- paddle/fluid/framework/custom_operator.cc | 4 ---- paddle/fluid/inference/api/analysis_predictor.cc | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/framework/custom_operator.cc b/paddle/fluid/framework/custom_operator.cc index cbc7d3fec2..66e28bb83c 100644 --- a/paddle/fluid/framework/custom_operator.cc +++ b/paddle/fluid/framework/custom_operator.cc @@ -667,10 +667,6 @@ void RegisterOperatorWithMetaInfo( void RegisterOperatorWithMetaInfoMap( const paddle::OpMetaInfoMap& op_meta_info_map) { auto& meta_info_map = op_meta_info_map.GetMap(); - - PADDLE_ENFORCE_EQ(meta_info_map.empty(), false, - platform::errors::PreconditionNotMet( - "No custom operator that needs to be registered.")); VLOG(1) << "Custom Operator: size of op meta info map - " << meta_info_map.size(); // pair: {op_type, OpMetaInfo} diff --git a/paddle/fluid/inference/api/analysis_predictor.cc b/paddle/fluid/inference/api/analysis_predictor.cc index 2ee8bb6073..2325524421 100644 --- a/paddle/fluid/inference/api/analysis_predictor.cc +++ b/paddle/fluid/inference/api/analysis_predictor.cc @@ -21,6 +21,7 @@ #include #include #include +#include "paddle/fluid/extension/include/ext_op_meta_info.h" #include "paddle/fluid/framework/feed_fetch_method.h" #include "paddle/fluid/framework/feed_fetch_type.h" #include "paddle/fluid/framework/ir/fuse_pass_base.h" @@ -617,6 +618,7 @@ std::unique_ptr CreatePaddlePredictor< static bool process_level_allocator_enabled; std::call_once(gflags_initialized, [&]() { + paddle::RegisterAllCustomOperator(); std::vector gflags; PADDLE_ENFORCE_GE( config.memory_pool_init_size_mb(), 0.f, -- GitLab