Combining individual Fsas to FsaVec
This is to support https://github.com/k2-fsa/snowfall/pull/35 @csukuangfj perhaps you have time to do this? It's probably more urgent than the pinned allocator stuff.
.. I am thinking we could perhaps call it stack(), since that's what it's really doing.(?) But of course this will cause a name clash with the same thing for ragged once we expose that. I wonder whether we should have separate namespaces, k2.fsa vs k2.ragged.
I think k2.create_fsa_vec already supports it.
Ah OK. There is something I'm not totally satisfied about here but not sure how to solve it.
Firstly, its documentation says: "Create an FsaVec from a list of FSAs "... Firstly, FsaVec is a notion from C++ that we haven't explained here. But also the documentation doesn't say whether the input must have 2 or 3 axes (presumably 2), and this notion isn't explained at the python level. I guess we don't have to explain it now, but I guess it will get confusing... There is a kind of conflict between the name Fsa at the Python level and Fsa at the C++ level. Again, not sure how to solve this. I always want documentation to be unambiguous in its meaning, so it's a shame that one word means 2 things. We can maybe consider changes in naming or structure to make this easier to explain in future.
BTW what do the axes mean in the Fsa object? I always observe shapes like: [156234, None] - is the first the number of states, and the second an indication that each state might have a variable number of arcs?
@pzelasko
BTW what do the axes mean in the Fsa object?
Please refer to the documentation: https://github.com/k2-fsa/k2/blob/66da100fc013cbd9a4d7f6ffaf6de3601c6e9ee8/k2/python/k2/fsa.py#L771-L777
I saw that, but I don't think it explains the meaning of the last "None" anywhere?
I saw that, but I don't think it explains the meaning of the last "None" anywhere?
The following note may be relevant:
https://github.com/k2-fsa/k2/blob/66da100fc013cbd9a4d7f6ffaf6de3601c6e9ee8/docs/array.txt#L29-L37
The Nones are for dimensions where the shape is not known because it is variable.
We definitely need to improve the documentation.