kaldi icon indicating copy to clipboard operation
kaldi copied to clipboard

The `Resize` function doesn't change `stride_` if resize_type == kSetZero and `rows == MatrixBase<Real>::num_rows_ && cols == MatrixBase<Real>::num_cols_`.

Open moshimo2019 opened this issue 1 year ago • 1 comments

          The `Resize` function doesn't change `stride_` if resize_type == kSetZero and `rows == MatrixBase<Real>::num_rows_ && cols == MatrixBase<Real>::num_cols_`.

The following code will crash if the column of the matrix to be loaded isn't multiple of 4

kaldi::Matrix<kaldi::BaseFloat> sli(0, 0, kaldi::kSetZero, kaldi::kStrideEqualNumCols);
std::ifstream ifs("matrix.txt");
sli.Read(ifs, false);
sli.Resize(sli.NumRows(), sli.NumCols(), kaldi::kSetZero, kaldi::kStrideEqualNumCols);
assert(sli.NumCols() == sli.Stride());

Originally posted by @moshimo2019 in https://github.com/kaldi-asr/kaldi/issues/2025#issuecomment-1912955329

moshimo2019 avatar Jan 27 '24 07:01 moshimo2019

This issue has been automatically marked as stale by a bot solely because it has not had recent activity. Please add any comment (simply 'ping' is enough) to prevent the issue from being closed for 60 more days if you believe it should be kept open.

stale[bot] avatar Apr 26 '25 02:04 stale[bot]