Open svandiekendialpad opened 1 year ago
I encountered a case where best_paths = k2.shortest_path(fsa, use_double_scores=True) can return an emtpy Fsa and was surprised that bool(best_paths) returns True. Is this by design or would you consider adding something like:
best_paths = k2.shortest_path(fsa, use_double_scores=True)
bool(best_paths)
True
class Fsa(object): [...] def __bool__(self) -> bool: return self.num_arcs > 0 [...]
I noticed the same behaviour for RaggedTensor where bool(k2.RaggedTensor([], dtype=torch.int32)) returns True.
RaggedTensor
bool(k2.RaggedTensor([], dtype=torch.int32))
I encountered a case where
best_paths = k2.shortest_path(fsa, use_double_scores=True)
can return an emtpy Fsa and was surprised thatbool(best_paths)
returnsTrue
. Is this by design or would you consider adding something like:I noticed the same behaviour for
RaggedTensor
wherebool(k2.RaggedTensor([], dtype=torch.int32))
returnsTrue
.