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

Template for contexts #72

Closed
danpovey opened this issue Jul 25, 2020 · 3 comments
Closed

Template for contexts #72

danpovey opened this issue Jul 25, 2020 · 3 comments

Comments

@danpovey
Copy link
Collaborator

Can someone please write a template that works for an arbitrary list of objects of possibly different types,
and does this:

ContextPtr GetContext(S &s, T &t, U &u, ..) {
   ContextPtr ans1 = s.Context(),  ans2 = GetContext(t, u, ..);
   assert(*ans1 == *ans2 && "Contexts mismatch");
   return ans1;  
}

You can make a PR to my cuda_draft branch, e.g. in context.h, although of course that branch doesn't compile.

@danpovey
Copy link
Collaborator Author

... BTW, that "assert" should really be something that happens in non-debug mode as well, since it could be caused
by user code. We'll have to decide on a mechanism for raising errors like this. Perhaps raising an exception? Might
be easier in the context of code called from Python.

@qindazhu
Copy link
Collaborator

OK, will do, maybe later today.

@qindazhu
Copy link
Collaborator

Will close this issue as we have implemented the function with PR https://github.com/danpovey/k2/pull/73

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

2 participants