From bdae229a023758f3ee1fcd3cca8df1d0e2568374 Mon Sep 17 00:00:00 2001 From: zhaojiaying01 Date: Wed, 23 Jan 2019 17:57:58 +0800 Subject: [PATCH] fix loadWhenPredict option in PaddleMobileCPUConfig --- src/io/ios_io/PaddleMobileCPU.h | 5 +++++ src/io/ios_io/PaddleMobileCPU.mm | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/io/ios_io/PaddleMobileCPU.h b/src/io/ios_io/PaddleMobileCPU.h index d38da70247..69e8b894d7 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 de801292e2..7103dce16b 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; } -- GitLab