-
Notifications
You must be signed in to change notification settings - Fork 69
Add readme for direct bindings #5216
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
Conversation
!build |
Review updated until commit 116baac Description
Changes walkthrough 📝
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
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.
Thanks a ton for updating this.
python/python_direct/README.md
Outdated
|
||
## How to add new Operation? | ||
* Add operation to `python_direct/ops.cpp` with docstring. | ||
* If operations corresponds with a new Expr node, add `void handle(const SomeOp*) final` to `python_direct/python_translate.cpp`. |
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.
naive question: is an Operation
not necessarily an Expr
?
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.
broadcast_in_dim
is a composite operation of BroadcastOp
and ExpandOp
. You may not need to add a handle
function for composite operations.
3. Add output values for Expr node to `visited_vals_`. | ||
4. Create dynamic scalar input arguments. This step is for view and expand operations. TensorView input arguments are handled via DAG traversal. Constant scalars are added directly to python defintion. | ||
5. Use `PythonPrinter::generateOperation` if the operation only uses positional arguments. This is mainly used for unary and binary operations. | ||
6. Use `PythonPrinter::generateKwargsOperation` if the operation uses keyword arguments. If none of the keyword arguments have default arguments, create a static vector of strings. If some of the keyword arguments have default arguments, create a vector of KeywordArgument. The KeywordArgument struct hold default values for keyword arguments. Use `std::nullopt` for keyword arguments without default values. |
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.
👏 nice to have.
though I felt the examples in python_translate.cpp was already pretty decent. 😜
1c0dc6f
to
116baac
Compare
!build |
No description provided.