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

GetPdf method in AmDiagGmm #305

Open
cffan opened this issue Sep 16, 2022 · 2 comments
Open

GetPdf method in AmDiagGmm #305

cffan opened this issue Sep 16, 2022 · 2 comments

Comments

@cffan
Copy link

cffan commented Sep 16, 2022

Hi, I note that the GetPdf method in AmDiagGmm isn't implemented. Have you found a workaround? If so, could you briefly explain it here and I can help adding it. Thanks!

@bmilde
Copy link
Contributor

bmilde commented Oct 16, 2022

What's the clif error message if you uncomment "# def GetPdf(self, pdf_index: int) -> DiagGmm"?

My guess is that it caused some problems with clif that weren't easy to resolve.

@asumagic
Copy link

asumagic commented Nov 4, 2022

FWIW, I am down a similar rabbit hole with Nnet.get_component.

I don't have a need for this particular function but it was easy enough for me to run a build with that GetPdf line uncommented, and the build succeeds. I cannot easily check if it actually works, though. However...
CLIF has seemingly decided that returning T& and const T& should result into a copy, which strikes to me as an astonishingly bad idea for default enforced implicit behavior.

This can be verified by checking at the generated wrapper code:

static PyObject* wrapGetPdf(PyObject* self, PyObject* args, PyObject* kw) {
// ...
  ::kaldi::DiagGmm ret0;
// ...
    ret0 = c->GetPdf(std::move(arg1));
// ...
  return Clif_PyObjFrom(std::move(ret0), {});

I am not familiar with what this class/method does, so could it be that the line was commented because this behavior was deemed misleading and undesirable in this case?
If so, adding a new C++ method returning a DiagGmm* and binding that instead may do the trick.
I don't know how concerned PyKaldi is about avoiding dangling references, though.

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

No branches or pull requests

3 participants