Skip to content
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

Merged
merged 5 commits into from
Oct 16, 2017

Conversation

QiJune
Copy link
Member

@QiJune QiJune commented Oct 16, 2017

Fix #4836

feed_inputs.resize(index + 1);
}
// shared data with input tensor
feed_inputs[index].ShareDataWith<T>(input);
Copy link
Collaborator

@JiayiFeng JiayiFeng Oct 16, 2017

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.

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.

Copy link
Collaborator

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>>());
Copy link
Collaborator

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"

Copy link
Collaborator

@reyoung reyoung left a 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.

@QiJune QiJune merged commit 9fc5936 into PaddlePaddle:develop Oct 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants