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

Generating python protobuf for paddle.v2.framework #2734

Merged

Conversation

reyoung
Copy link
Collaborator

@reyoung reyoung commented Jul 4, 2017

Python should be able to manipulate Protobuf message because:

  1. Python's create_op_creation_methods take the OpProto array to
    generate all op_creation_methods in RunTime.

  2. All op_creation_methods will create an OpDesc and pass it to
    Paddle C++ method CreateOp and return the Op handle.

Here is the list of what is added in this commit:

  • Add py_proto_compile function in cmake/generic.cmake.
  • Add an empty package named paddle.v2.framework, all python code of
    paddle::framework will be in that package.
  • Generate protobuf's python module __init__.py by touch while
    compiling.
  • Change setup.py.in, make paddle.v2.framework.proto uses the
    generated protobuf pythons.

@reyoung reyoung requested review from a user, jacquesqiao and gangliao July 4, 2017 08:17
@reyoung reyoung force-pushed the feature/v2_framework_for_python branch 5 times, most recently from f6dc08a to 3d88504 Compare July 5, 2017 04:47
Copy link
Member

@jacquesqiao jacquesqiao left a comment

Choose a reason for hiding this comment

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

LGTM!

@reyoung reyoung force-pushed the feature/v2_framework_for_python branch 5 times, most recently from 9c7e551 to 9293625 Compare July 6, 2017 06:12
Python should be able to manipulate Protobuf message because:

1. Python's `create_op_creation_methods` take the `OpProto` array to
   generate all `op_creation_methods` in RunTime.

2. All `op_creation_methods` will create an `OpDesc` and pass it to
   Paddle C++ method `CreateOp` and return the Op handle.

Here is the list of what is added in this commit:

* Add `protobuf_generate_python` if it is not defined.
  * Before cmake 3.4, `protobuf_generate_python` is not defined. Just
    copy the implementation of that function in `protobuf.cmake`
* Add `py_proto_compile` function in `cmake/generic.cmake`.
  * It follows bazel's API interface.
    * https://github.com/pubref/rules_protobuf#rules
* Add an empty package named `paddle.v2.framework`, all python code of
  `paddle::framework` will be in that package.
* Generate protobuf's python module `__init__.py` by `touch` while
  compiling.
* Change setup.py.in, make `paddle.v2.framework.proto` uses the
  generated protobuf pythons.
@reyoung reyoung force-pushed the feature/v2_framework_for_python branch from 9293625 to e2ea1f4 Compare July 6, 2017 07:30
@reyoung reyoung merged commit 0884475 into PaddlePaddle:develop Jul 6, 2017
@reyoung reyoung deleted the feature/v2_framework_for_python branch July 13, 2017 11:39
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

2 participants