-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
export feed/fetch variable method to Python #4837
Conversation
7496a2b
to
5fe3f8f
Compare
feed_inputs.resize(index + 1); | ||
} | ||
// shared data with input tensor | ||
feed_inputs[index].ShareDataWith<T>(input); |
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.
I tend to use CopyFrom()
here, for I think a fed tensor shouldn't have a direct relationship with origin tensor. However, I could be wrong.
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.
FeedOp will make a copy of the data [code], so I believe it is okay for it to be shared here.
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.
I see. Thanks!
// be created. | ||
Variable* g_feed_value = GetGlobalScope().Var(var_name); | ||
auto& feed_inputs = | ||
*(g_feed_value->GetMutable<std::vector<paddle::framework::LoDTensor>>()); |
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.
Please use global typedefs here.
#include "paddle/framework/feed_fetch_type.h"
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.
LGTM, please merge it first, then submit another PR to change type defines.
Fix #4836