-
Notifications
You must be signed in to change notification settings - Fork 217
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
rewrite pybind interface for Array2 and Fsa #69
Conversation
You can leave the interfaces as they are. To wrap them to python, you only need to add an indirection. Take void ArcSorter::GetOutput(Fsa *fsa_out, int32_t *arc_map /*= nullptr*/) const as an example, you can use pyclass.def("get_output", [](const ArcSorter& self, Fsa* fsa_out, std::vector<int32_t>* arc_map = nullptr) {
self.GetOutput(fsa_out, arc_map ? arc_map->data() : nullptr);
}, py::arg("fsa_out"), py::arg("arc_map") = nullptr
); I assume that you have made |
I make |
You can still leave the interfaces as they are. Just replace |
Alternatively, you can replace |
Oh, you're right, as we could just change the interface in Python code.
I would like to choose this one as constructing |
Anyway, there is no need to change |
4fa6ba9
to
6628c33
Compare
Updated, thanks @csukuangfj for the suggestions. |
+1 |
Thanks for the review Fangjun!
It's OK with me. I'm not doing a detailed review as I want to focus on
figuring out some next-steps stuff.
…On Wed, Jul 22, 2020 at 8:47 PM Fangjun Kuang ***@***.***> wrote:
+1
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<https://github.com/danpovey/k2/pull/69#issuecomment-662432514>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZFLO2E6JKJ3MPU6OCNMWTR43NVZANCNFSM4PETU43A>
.
|
Merging.. |
Guys, please have a review. This PR is relatively important, if the whole structure/style is fine, I will follow it to wrap other algorithms to python (most of them will be straightforward).
Note as in Python, we cannot pass primitive type (int, float, etc.) to function as reference/pointer, I get
Array1
back to support thosearc_map
(see example inarc_sort
)