-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enable infer api with multi-threads #11162
Conversation
@@ -54,17 +54,23 @@ std::string num2str(T a) { | |||
} | |||
} // namespace | |||
|
|||
bool NativePaddlePredictor::Init() { | |||
bool NativePaddlePredictor::Init(std::shared_ptr<framework::Scope> scope) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be unique_ptr? and std::moved around?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there no change in CreatePaddlePredictor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be unique_ptr? and std::moved around?
I am afraid not, this scope should be parent scope and the sub scope should be depend on it
Why is there no change in CreatePaddlePredictor?
Because as default only need change Clone
.
@@ -34,14 +34,15 @@ class NativePaddlePredictor : public PaddlePredictor { | |||
explicit NativePaddlePredictor(const NativeConfig &config) | |||
: config_(config) {} | |||
|
|||
bool Init(); | |||
// will only create sub scope if have global scope | |||
bool Init(std::shared_ptr<framework::Scope> scope = nullptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it explicit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure~ will update it.
According to @Superjomn 's suggestion, the usage should be like this:
So, we should only focus on thread-safe and sharing parameters.