-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Don't map operator name to Python functions #3198
Comments
What argument should Should it be core.operator("Mul", input={
"A": "var_a",
"B": "var_b"
}, output={
"Out": "var_out"
}, attr={
"some_attr": 1.0,
"other_attr": [1,2,3,4]
}) or core.operator("Mul", A="var_a", B="var_b", Out="var_out", some_attr=1.0, other_attr=[1,2,3,4]) Also, what reference documentation of operator should be? Currently, op_creations.xxx generate the docstring from Paddle C++ core. Like >> help(op_creations.add_two)
Help on function add_two in module paddle.v2.framework.create_op_creation_methods:
add_two(*args, **kwargs)
Two Element Add Operator.
The equation is: Out = X + Y
:param X: The first input of add op
:type X: basestr
:param Y: The second input of add op
:type Y: basestr
:param Out: The output of add op
:type Out: basestr |
Either API call in your case @reyoung looks good to me. My point is that the primary document of source code is the source code itself. I understand that a Python wrapper like |
OK. I will choose the second API in implementation because it seems that less code for the user.
Python docstring can generate I agree that the most straight-forward document is code itself. But for end-user, a HTML pages is necessary. In this way we do not generate function to each operator, we must figure out how to generate a HTML file from C++ operator. Maybe to generate an markdown file for each operator is OK? I will add other issue for operator documentation generating when the second API is done. |
I think we need documents for two levels of API
Both levels of documentation can have HTML format. |
@wangkuiyi I am working on this issue #3169 today. I will change the Python API tomorrow. |
Currently use `Operator("fc", X="x", W='w1', B='b1')` as operator creation method. Fix PaddlePaddle#3198
This introduces extra complexity compared with
The former approach would create confusion for our users -- users might see a call in an example program like
fc(...)
but s/he cannot grep the codebase to find the definition of functionfc
.The text was updated successfully, but these errors were encountered: