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

Feature/py executor test #4922

Merged
merged 77 commits into from
Oct 19, 2017
Merged

Conversation

reyoung
Copy link
Collaborator

@reyoung reyoung commented Oct 19, 2017

Fix #4902

reyoung and others added 30 commits October 11, 2017 12:08
and Rename `Sync` to `Flush`
Since lots of types can be cast to bool
1. It is no need to make global scope thread-safe, since it will be
invoked in Python main thread.
2. Do not free the global scope when C++ exit. Let the OS free memories,
otherwise, we need to handle the destroy dependencies.

See
https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables
b_np = numpy.random.random((784, 100)).astype('float32')
tensor_b = core.LoDTensor()
tensor_b.set(b_np, place)
# del input_tensor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this comment for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo

@@ -256,7 +256,8 @@ def __init__(self,
self.desc.set_block_attr(attr_name, attrs[attr_name].desc)

self.desc.check_attrs()
self.desc.infer_shape(self.block.desc)
if type not in {'feed', 'fetch'}:
self.desc.infer_shape(self.block.desc)
Copy link

@tonyyang-svail tonyyang-svail Oct 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't we infer shape a feed/fetch?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InferVarType is also needed.

self.desc.infer_var_type(self.block.desc)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here infer_shape is a compile-time method. Feed/Fetch op is a run-time operator, do not need to infer shape.

Copy link
Collaborator Author

@reyoung reyoung Oct 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InferVarType is also needed.

Add in following PRs

'b': tensor_b},
fetch_list=[out]))
out = numpy.array(outs[0])
self.assertEqual((100, 100), out.shape)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to check the result

self.assertTrue(numpy.allclose(out, numpy.dot(a_np, b_np)))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -256,7 +256,8 @@ def __init__(self,
self.desc.set_block_attr(attr_name, attrs[attr_name].desc)

self.desc.check_attrs()
self.desc.infer_shape(self.block.desc)
if type not in {'feed', 'fetch'}:
self.desc.infer_shape(self.block.desc)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InferVarType is also needed.

self.desc.infer_var_type(self.block.desc)

AddInput("X", "The input of fetch op");
AddOutput("Out", "The output of fetch op");
AddComment("fetch op, it should not be configured by users directly");
AddAttr<int>("col", "column of feed");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

column of feed --> column of fetch

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

feed_var_name='feed',
fetch_var_name='fetch'):
if not isinstance(program, Program):
raise TypeError()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error message?

@reyoung reyoung merged commit 3db5278 into PaddlePaddle:develop Oct 19, 2017
@reyoung reyoung deleted the feature/py_executor_test branch October 28, 2017 22:13
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.

4 participants