diff --git a/src/io/ios_io/PaddleMobileCPU.h b/src/io/ios_io/PaddleMobileCPU.h index d38da70247beb0e91b6c69d3c7a1c8bb407c128e..69e8b894d7b16eefa36259b479902e6185e5a36e 100644 --- a/src/io/ios_io/PaddleMobileCPU.h +++ b/src/io/ios_io/PaddleMobileCPU.h @@ -44,6 +44,11 @@ */ @property (assign, nonatomic) BOOL optimize; +/** + @b 是否预测时初始化内存,用于处理可变输入 + */ +@property (assign, nonatomic) BOOL loadWhenPredict; + @end @interface PaddleMobileCPU : NSObject diff --git a/src/io/ios_io/PaddleMobileCPU.mm b/src/io/ios_io/PaddleMobileCPU.mm index de801292e225da4f1d21886bdc919c2a2fdcdd7c..7103dce16b4eeed8b2e63c93f5dbf4b122f06a84 100644 --- a/src/io/ios_io/PaddleMobileCPU.mm +++ b/src/io/ios_io/PaddleMobileCPU.mm @@ -73,6 +73,8 @@ static std::mutex shared_mutex; - (instancetype)initWithConfig:(PaddleMobileCPUConfig *)config { if (self = [super init]) { + paddle_mobile::PaddleMobileConfigInternal configInternal; + configInternal.load_when_predict = config.loadWhenPredict; pam_ = new paddle_mobile::PaddleMobile(); _config = config; }