Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions k2/csrc/intersect_dense_pruned.cu
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ class MultiGraphDenseIntersectPruned {
frames_.reserve(T + 2);

if (T_ == 0) frames_.push_back(InitialFrameInfo());
int32_t prune_num_frames = 15, prune_shift = 10;

for (int32_t t = 0; t <= b_fsas_->shape.MaxSize(1); t++) {
if (state_map_.NumKeyBits() == 32) {
Expand All @@ -289,12 +288,8 @@ class MultiGraphDenseIntersectPruned {
K2_CHECK_EQ(state_map_.NumKeyBits(), 40);
frames_.push_back(PropagateForward<40>(t, frames_.back().get()));
}
if (t != 0 && (T_ + t) % prune_shift == 0 ||
t == b_fsas_->shape.MaxSize(1)) {
int32_t prune_t_begin =
(T_ + t - prune_num_frames) > 0 ? (T_ + t - prune_num_frames) : 0;
int32_t prune_t_end = T_ + t;
PruneTimeRange(prune_t_begin, prune_t_end);
if (t == b_fsas_->shape.MaxSize(1)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pkufool I'm just curious about this change here, was it to fix some kind of bug?
I think the goal here with the periodic pruning was to reduce memory consumption, but it's not impossible that the implementation could have been buggy (or unnecessary in practice).

Copy link
Collaborator Author

@pkufool pkufool May 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For streaming decoding, we will invoke this function every chunk, so I think we only need to prune once for each chunk, this fix is for efficiency.

[edit] This PR is not the fixes for the bug #1194 , I have not fixed it yet.

PruneTimeRange(T_ - 1, T_ + t);
}
}
// The FrameInfo for time T+1 will have no states. We did that
Expand Down
91 changes: 0 additions & 91 deletions k2/csrc/online_dense_intersector.h

This file was deleted.